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


View this message in rfc822 format

From: "Dale R. Worley" <worley <at> alum.mit.edu>
To: Antonio Diaz Diaz <antonio <at> gnu.org>
Cc: 70511 <at> debbugs.gnu.org
Subject: bug#70511: Option to grep into compressed files
Date: Wed, 01 May 2024 15:20:07 -0400
Antonio Diaz Diaz <antonio <at> 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




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.