walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
585 stars 17 forks source link

moar not able to pipe multiple filename #187

Closed ciscohack closed 5 months ago

ciscohack commented 5 months ago

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

walles commented 5 months ago

What was your expectation in this case?

ciscohack commented 5 months ago

@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

ciscohack commented 5 months ago

@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

postsolar commented 5 months ago

I'm just curious, why not use ug regex file1 file2 directly? It prints the filename as well. Works with grep, rg and ug.

ciscohack commented 5 months ago

@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

walles commented 5 months ago

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

ciscohack commented 5 months ago

@walles that is ok.. lets moar have the capability to parse multiple files

ciscohack commented 5 months ago

@walles is this code "https://github.com/walles/moar/commit/f4af673d3c22e8435f51ee384ae7c67168bf4d38" committed. I didn't get an update yet.

walles commented 5 months ago

I have now made releases, latest is v1.23.3, and that one has your multiple-files thingy in it.

ciscohack commented 5 months ago

@walles ok thank you so much