Antonio Diaz Diaz <anto...@gnu.org> writes: > Dale R. Worley wrote: >> So the construction I'm thinking of would be >> >> grep ... --use-compress-program=zcat ... pattern file ...
> Zcat does indeed accept (and ignore) option -d for compatibility with gzip. > Therefore all that is needed is to implement a way for grep to delegate > decompression to zcat. > Zcat also supports the (obsolete) compress format (.Z) through gzip. I missed those facts. I only skimmed the section of http://www.nongnu.org/zutils/manual/zutils_manual.html about Zcat and hadn't read the "Common options" section which makes those clear. I'll have to remember that zcat has this nice functionality. I'm not interested enough in this to implement it, but I'll leave this one note for anyone who is researching the possibility: You might be concerned that starting a e.g. zcat process for every file to scan would be excessively high overhead. But many years ago, I modified "tar" to be able to compress each file individually (rather than the entire archive collectively). Each file was processed by a separate gzip process, and in my usage written to an Exabyte tape. I was worried that all these process invocations would slow down the backup, but even on a low-speed 486, the processes were insignificant. So I never improved the implementation to use an internal compression library. Apparently once all the needed files are in the buffers, creating yet another process from them is quick. Dale