gron icon indicating copy to clipboard operation
gron copied to clipboard

Adds a -H/--with-filename option ala grep, to include the filename in gron'ed output, for when processing multiple files (e.g., within find).

Open RossPatterson opened this issue 5 years ago • 1 comments

I needed to grep for a JSON value across a large collection of files, and found myself doing find . -type f -exec gron {} \; | grep whatever, but then I couldn't identify which files contained the matches. grep has a -H / --with-filename option, that prefixes each output line with filename: fro just such uses (e.g., with grep -r), and that seemed like the right answer. This change adds that option to gron, using "-" for the filename when the input is stdin.

RossPatterson avatar Jun 26 '20 17:06 RossPatterson

It's been several years since I created this PR, but if the gron maintainers are interested in mergong it, I'll make sure the changes are compatible with the current source.

RossPatterson avatar Jul 06 '23 13:07 RossPatterson