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

From: Antonio Diaz Diaz <[email-masked]>
Date: Tue, 30 Apr 2024 20:26:57 +0200

Dale R. Worley wrote:
> So the construction I'm thinking of would be
>
>      grep ... --use-compress-program=zcat ... pattern file ...

Ah! interesting.

Zgrep duplicates some of the work of grep. For example it recurses through 
directories, feeds grep one file at a time, and prepends the file name to 
the output of grep if needed.

Delegating the decompression to zcat as you propose would allow the full use 
of grep's features. If it is possible it would be possibly the best option.

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

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.

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

Zcat also supports the (obsolete) compress format (.Z) through gzip.

Of the other two, lzma should be better removed from tar, and I do not 
remember to have seen any tarball compressed with lzop (maybe because it 
compresses less than gzip).

Best regards,
Antonio.