how to grep multiply strings

Tom Christiansen tchrist at convex.COM
Sat Feb 2 05:08:38 AEST 1991


>From the keyboard of pat at ctycal.UUCP (Patrick Woo):
:I am trying to display line that doesn't contain string1 or string2 or ...
:stringn.

:What I did was
:
:grep -v string1 | grep -v string2 | .... | grep -v stringn
:
:Just wondering if there is an easier way other than doing all this piping.
:Thanks in advance.

    egrep -v 'string1|string2|string3|...|stringN' file

or put them in a file and use 

    fgrep -vf badstrings file

Bear in mind that most standard fgrep's are terribly slow.

--tom
--
"Hey, did you hear Stallman has replaced /vmunix with /vmunix.el?  Now
 he can finally have the whole O/S built-in to his editor like he
 always wanted!" --me (Tom Christiansen <tchrist at convex.com>)



More information about the Comp.unix.questions mailing list