GNU bug report logs - #78772
Feature request: glob-matching patterns

Previous Next

Package: grep;

Reported by: Philip Prindeville <philipp <at> redfish-solutions.com>

Date: Thu, 12 Jun 2025 03:31:01 UTC

Severity: wishlist

To reply to this bug, email your comments to 78772 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#78772; Package grep. (Thu, 12 Jun 2025 03:31:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Philip Prindeville <philipp <at> redfish-solutions.com>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Thu, 12 Jun 2025 03:31:02 GMT) Full text and rfc822 format available.

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

From: Philip Prindeville <philipp <at> redfish-solutions.com>
To: bug-grep <at> gnu.org
Subject: Feature request: glob-matching patterns
Date: Wed, 11 Jun 2025 21:29:35 -0600
It might be useful to have an argument like --glob-regexp to have a file containing globbing patterns to match (or exclude) against a stream of filenames.

Example:

find . -print -depth | grep -v --glob-regexp -f do-not-backup-list | cpio -ov > filtered-backup.cpio

Where files matching glob patterns in "do-not-backup-list" would be excluded.

Thanks





Information forwarded to bug-grep <at> gnu.org:
bug#78772; Package grep. (Fri, 13 Jun 2025 18:09:02 GMT) Full text and rfc822 format available.

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

From: "Dale R. Worley" <Dale.Worley <at> comcast.net>
To: Philip Prindeville <philipp <at> redfish-solutions.com>
Cc: 78772 <at> debbugs.gnu.org
Subject: Re: bug#78772: Feature request: glob-matching patterns
Date: Fri, 13 Jun 2025 14:07:59 -0400
Philip Prindeville via Bug reports for GNU grep <bug-grep <at> gnu.org>
writes:
> It might be useful to have an argument like --glob-regexp to have a
> file containing globbing patterns to match (or exclude) against a
> stream of filenames.

It seems to me what you want is an argument that causes grep to
interpret patterns as shell "globs" rather than as regexps.  (Note that
the glob language is considerably weaker than regexps, and AFAIK they
are never called "regexps".)  So a better name would be "--glob".

I can see value in that.

Is there an unambiguous standard for globs?  I know that different
shells do globbing somewhat differently.  Although I notice that grep
has these options that take glob arguments, so the code in grep must
contain a glob-matcher already, and thus a definition of glob-patterns.

       --exclude=GLOB
       --exclude-dir=GLOB
       --include=GLOB

Dale




Information forwarded to bug-grep <at> gnu.org:
bug#78772; Package grep. (Fri, 13 Jun 2025 19:19:02 GMT) Full text and rfc822 format available.

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

From: Philip Prindeville <philipp <at> redfish-solutions.com>
To: "Dale R. Worley" <Dale.Worley <at> comcast.net>
Cc: 78772 <at> debbugs.gnu.org
Subject: Re: bug#78772: Feature request: glob-matching patterns
Date: Fri, 13 Jun 2025 13:17:49 -0600

> On Jun 13, 2025, at 12:07 PM, Dale R. Worley <Dale.Worley <at> comcast.net> wrote:
> 
> Philip Prindeville via Bug reports for GNU grep <bug-grep <at> gnu.org>
> writes:
>> It might be useful to have an argument like --glob-regexp to have a
>> file containing globbing patterns to match (or exclude) against a
>> stream of filenames.
> 
> It seems to me what you want is an argument that causes grep to
> interpret patterns as shell "globs" rather than as regexps.  (Note that
> the glob language is considerably weaker than regexps, and AFAIK they
> are never called "regexps".)  So a better name would be "--glob".
> 
> I can see value in that.
> 
> Is there an unambiguous standard for globs?  I know that different
> shells do globbing somewhat differently.  Although I notice that grep
> has these options that take glob arguments, so the code in grep must
> contain a glob-matcher already, and thus a definition of glob-patterns.
> 
>       --exclude=GLOB
>       --exclude-dir=GLOB
>       --include=GLOB
> 
> Dale

Corrected. —-glob or —-glob-pattern ...

Yes, it seemed like a light lift using the globbing already included.

And POSIX globbing is fine.



This bug report was last modified today.

Previous Next


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