bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#37754: wish for grep --and -eX -eY -eZ (X∩Y∩Z intersection, not X∪Y∪


From: Trent W. Buck
Subject: bug#37754: wish for grep --and -eX -eY -eZ (X∩Y∩Z intersection, not X∪Y∪Z union)
Date: Wed, 18 Jan 2023 12:57:53 +1100

On Fri 18 Oct 2019 22:49:23 +1100, Trent W. Buck wrote:
> Paul Eggert wrote:
> > On 10/16/19 5:19 PM, Trent W. Buck wrote:
> > > I would expect "grep -Fw -e 4GB -e DDR4 --and" to print the same thing as
> > >
> > >      grep -Fw 4GB | grep -Fw DDR4 | grep -Fw -e 4GB -e DDR4 -o
> >
> > You're right, it's not obvious. :-)
> >
> > It may be better to just pipe greps together, as you do now. That's simple
> > and fast enough for this relatively-uncommon case, and it's portable to all
> > greps.
> 
> I admit that most of the time, I want "grep --and" for a small dataset
> (<1MB computer_parts.txt), so it's merely a convenience.

I noticed I forgot to attach a helper script I've been using for decades.
Here it is.

Attachment: foldr.sh
Description: Bourne shell script


reply via email to

[Prev in Thread] Current Thread [Next in Thread]