tomnomnom / gron

Make JSON greppable!
MIT License
13.73k stars 325 forks source link

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). #72

Open RossPatterson opened 4 years ago

RossPatterson commented 4 years ago

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 commented 1 year ago

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.