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 #29 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: Thu, 25 Apr 2024 17:15:19 -0400
People have mentioned that it's best for a utility "to do one thing
well".  It seems to me that even the existing grep options do three
things (in the complex use cases):

- select a set of files
- uncompress the files (if they're compressed)
- search within the file contents

I am ignoring the case of extracting members from archive files.

It seems to me that if one wanted to do a version of this that isn't
covered by the existing grep options, step 1 can best be done by
"find".  Step 3 can be done by running grep on each set of contents,
with --label=name to get output lines labeled with the original file
name.

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.
Ideally, it would be programmable in something like the manner of "file"
so that additional compression formats could be fitted into the
framework, and it could use either a compiled-in decompression library
(like zlib) or call an external decompression program, as necessary.

Actually, I'm asking whether anybody knows whether such a tool exists
already.  It seems like a "natural" facility that somebody would have
thought to write maybe fifteen years ago.

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.