Subject: bug#70511: Option to grep into compressed files

From: "Dale R. Worley" <[email-masked]>
Date: Sun, 28 Apr 2024 17:25:36 -0400

Antonio Diaz Diaz <[email-masked]> writes:
> Dale R. Worley wrote:
>> What doesn't seem to exist is something that does step 2 in a general
>> way.  The tool that is needed is something that reads the first few
>> bytes of a file, determines which compression signature is present if
>> any, then processes the contents through the correct decompressor.
>
> Such tool[1] does in fact exist since 2009. It is only that it is not yet 
> widely known. :-)
>
> [1] http://www.nongnu.org/zutils/manual/zutils_manual.html#Zgrep

Looking at that page, I think you meant to point to #Zcat.  But yes, it
does seem to do that job.

Mary via Bug reports for GNU grep <[email-masked]> writes:
> GNU tar also supports `-I, --use-compress-program=PROG   filter
> through PROG (must accept -d)`, which is one of the reasons I thought
> it would be relevant to add a similar option to grep.

So the construction I'm thinking of would be

    grep ... --use-compress-program=zcat ... pattern file ...

except it looks like zcat doesn't accept -d (which would need to be a
no-op for it).

Though it looks like zcat supports five compression techniques and gnu
tar handles eight, so zcat should be expanded there.

Dale