GNU bug report logs - #70511
Option to grep into compressed files

Previous Next

Package: grep;

Reported by: Mary <marycada <at> proton.me>

Date: Mon, 22 Apr 2024 06:52:04 UTC

Severity: normal

Full log


Message #41 received at 70511 <at> debbugs.gnu.org (full text, mbox):

From: "Dale R. Worley" <worley <at> alum.mit.edu>
To: 70511 <at> debbugs.gnu.org
Subject: Re: bug#70511: Option to grep into compressed files
Date: Sun, 28 Apr 2024 17:25:36 -0400
Antonio Diaz Diaz <antonio <at> gnu.org> 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 <bug-grep <at> gnu.org> 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




This bug report was last modified 1 year and 39 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.