How do I make use of complex logical operations with egrep?
I can simply do, “egrep -v C abc.txt” to implement not of C and find that in abc.txt.
I can do “egrep A.*B abc.txt” to implement and of A and C to find that in abc.txt.
But how do I do something like,
A AND B (NOT C)
I googled around but couldn’t find a working solution.
Any help is much appreciated!
The simplest way would be to pipe the output of one
grepinto the input of another:Mind you, that’s more of “A then B” than it is “A and B”. If you need more sophisticated matching logic I suggest you check out
awk.