#813356 wish for glob(7)-like matcher

Package:
grep
Source:
grep
Description:
GNU grep, egrep and fgrep
Submitter:
"Trent W. Buck"
Date:
2019-10-15 01:48:03 UTC
Severity:
wishlist
#813356#5
Date:
2016-02-01 07:19:06 UTC
From:
To:
Sometimes I want to match globs instead of regexps.
glob(7) explicitly says:
  "they match filenames, rather than text"
I don't see why globs shouldn't be used for text.


In bash this is ugly and *SLOW*, e.g.

    # Print log lines that match no "whitelisted" patterns.
    while read -r line
    do
        if ! [[ line = glob1 || line = glob2 || ... ]]
        then echo "$line"
        fi
    done <log

instead of

    grep --basic-glob -vf whitelist log


GNU grep already has options for fixed strings (-F),
and BRE, ERE and PCRE.  Can we have one for glob(7)?

AFAICT nobody has asked for this before; this surprises me,
because it "feels" like it should be easy to implement.

Am I wrong?

Is there a good reason to WONTFIX this?



I asked my peers and the only real counterargument I got was
"just learn regexps, you'll need them eventually".

For my use case, I think globs would be more readable (esp. not having
to escape dots and parens), and easier to teach to non-technical staff.
(I haven't trialled it yet, because I don't have a globber that's as
fast as GNU grep is for regexps.)


PS: I'd have directly reported this upstream,
but https://sv.gnu.org/bugs/?group=grep says I must be a "project member",
and I'm not.

#813356#8
Date:
2019-09-26 15:07:16 UTC
From:
To:
Hi Trent,

Mmm, sorry, it seems I haven't answered to this bug report!

I would give you a similar answer to https://bugs.debian.org/940464:
Could you please forward it directly to upstream, sending a mail to
bug-grep@gnu.org?

Cheers, and sorry for this very late answer,