Hello, I added an option to grep that filters files through a specified program. The main purpose for that is to uncompress files using the zcat (or `gzip -d`) command, or an equivalent for another compression format.
It works like this: grep -j zcat pattern textfile.gz [textfile2.gz...] (I chose `-j` for no particular reason. Any unused letter could go there.) This will spawn a shell and execute the given command (zcat), which will receive each file through stdin and its stdout will be used in lieu of the file. Any valid shell command can be used instead of zcat. This is better than the zgrep commands provided by the gzip, bzip2 and xz projects, because it supports all of the options, including `-r`. It can also be used with arbitrary commands, like less popular compression algorithms or even commands unrelated to compression. I read at https://www.gnu.org/software/grep/devel.html that there were plans to add `-Z` and `-J` options for gzip and bzip2; my implementation can support any algorithm. The problem I see with that though is that it would add a shell command option to grep. This is longer to type our than `-Z` or `-J`, but it also provides a shell access to anybody who can control what options grep receives. In practice, I'm not sure how serious that is, but I thought it would be useful to point it out. I have a patch that I can send. I believe my patch is trivial, the only part that's longer than 3 lines is a simple fork-exec pattern (40 lines including whitespace, but they're the same you've seen in plenty of other programs). I know there are specific requirements regarding copyright, and I don't want to cause problems about that (I can't sign the FSF's documents). May I send my patch? -- Mary PS- This is my first time using a mailing list, please let me know if I'm doing something wrong!