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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: grep; Reported by: Mary <marycada@HIDDEN>; dated Mon, 22 Apr 2024 06:52:04 UTC; Maintainer for grep is bug-grep@HIDDEN.

Message received at submit <at>

Received: (at submit) by; 22 Apr 2024 06:51:36 +0000
From debbugs-submit-bounces <at> Mon Apr 22 02:51:36 2024
Received: from localhost ([]:45560
	by with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at>>)
	id 1rynWY-0005NP-In
	for submit <at>; Mon, 22 Apr 2024 02:51:36 -0400
Received: from ([2001:470:142::17]:39556)
 by with esmtp (Exim 4.84_2)
 (envelope-from <marycada@HIDDEN>) id 1ryaLE-0002sw-CN
 for submit <at>; Sun, 21 Apr 2024 12:47:04 -0400
Received: from ([2001:470:142:3::10])
 by with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <marycada@HIDDEN>)
 id 1ryaKq-0003aX-Cv
 for bug-grep@HIDDEN; Sun, 21 Apr 2024 12:46:39 -0400
Received: from ([])
 by with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <marycada@HIDDEN>)
 id 1ryaKn-00027Q-0e
 for bug-grep@HIDDEN; Sun, 21 Apr 2024 12:46:35 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;;
 s=protonmail; t=1713717983; x=1713977183;
Date: Sun, 21 Apr 2024 16:46:17 +0000
To: "bug-grep@HIDDEN" <bug-grep@HIDDEN>
From: Mary <marycada@HIDDEN>
Subject: Option to grep into compressed files
Message-ID: <>
Feedback-ID: 107467773:user:proton
X-Pm-Message-ID: 6f9ee145bc8d83ce2913fea35fb99e864c33b858
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=; envelope-from=marycada@HIDDEN;
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Mon, 22 Apr 2024 02:51:31 -0400
X-BeenThere: debbugs-submit <at>
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <>
List-Unsubscribe: <>, 
 <mailto:debbugs-submit-request <at>>
List-Archive: <>
List-Post: <mailto:debbugs-submit <at>>
List-Help: <mailto:debbugs-submit-request <at>>
List-Subscribe: <>, 
 <mailto:debbugs-submit-request <at>>
Errors-To: debbugs-submit-bounces <at>
Sender: "Debbugs-submit" <debbugs-submit-bounces <at>>
X-Spam-Score: -0.0 (/)


I added an option to grep that filters files through a specified program. T=
he main purpose for that is to uncompress files using the zcat (or `gzip -d=
`) command, or an equivalent for another compression format.

It works like this:

    grep -j zcat pattern textfile.gz [textfile2.gz...]

(I chose `-j` for no particular reason. Any unused letter could go there.)

This will spawn a shell and execute the given command (zcat), which will re=
ceive each file through stdin and its stdout will be used in lieu of the fi=
le. Any valid shell command can be used instead of zcat.

This is better than the zgrep commands provided by the gzip, bzip2 and xz p=
rojects, because it supports all of the options, including `-r`.

It can also be used with arbitrary commands, like less popular compression =
algorithms or even commands unrelated to compression. I read at https://www= that there were plans to add `-Z` and `-J=
` options for gzip and bzip2; my implementation can support any algorithm.

The problem I see with that though is that it would add a shell command opt=
ion to grep. This is longer to type our than `-Z` or `-J`, but it also prov=
ides a shell access to anybody who can control what options grep receives. =
In practice, I'm not sure how serious that is, but I thought it would be us=
eful to point it out.

I have a patch that I can send. I believe my patch is trivial, the only par=
t that's longer than 3 lines is a simple fork-exec pattern (40 lines includ=
ing whitespace, but they're the same you've seen in plenty of other program=
s). I know there are specific requirements regarding copyright, and I don't=
 want to cause problems about that (I can't sign the FSF's documents). May =
I send my patch?

-- Mary

PS- This is my first time using a mailing list, please let me know if I'm d=
oing something wrong!

Acknowledgement sent to Mary <marycada@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-grep@HIDDEN. Full text available.
Report forwarded to bug-grep@HIDDEN:
bug#70511; Package grep. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 22 Apr 2024 07:00:02 UTC

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