Closed ciscohack closed 10 months ago
What was your expectation in this case?
@walles expectation is moar should parse these 2 files and then grep the keyword I am trying to look at... I can do the same with BAT
@walles you are awesome my friend . just one last query on this.. I hope when we run moar file1 file2 file3 | grep 'keyword'
it will show the filename in header to tell output is pulled form which file
I'm just curious, why not use ug regex file1 file2
directly? It prints the filename as well. Works with grep
, rg
and ug
.
@postsolar yes you can use ug but i have some use case with moar to read filed then use grep to filter out needy data
I hope when we run moar file1 file2 file3 | grep 'keyword'
it will show the filename in header to tell output is pulled form which file
Not possible. Even if moar
would contaminate its output with headers, grep
likely wouldn't match those so you wouldn't see them anyway.
@postsolar's suggestion would work though, and that's how this is generally done: ug regex file1 file2 file3
@walles that is ok.. lets moar have the capability to parse multiple files
@walles is this code "https://github.com/walles/moar/commit/f4af673d3c22e8435f51ee384ae7c67168bf4d38" committed. I didn't get an update yet.
I have now made releases, latest is v1.23.3
, and that one has your multiple-files thingy in it.
@walles ok thank you so much
If trying to pipe multiple files with moar then it fails to parse the multiple files and throw error
moar core.txt asa.txt | ug 'down' | ug 'flap'
ERROR: Expected exactly one filename, or data piped from stdin