[wplug] quick grep question

Brian Medley bpm-list-wplug at 4321.tv
Sun Sep 14 19:27:38 EDT 2003


On Sun, Sep 14, 2003 at 06:36:51PM -0400, Russ Schneider wrote:

> Does grep have any OR or AND capabilities?
> 
> I'd like to grep a file for lines that don't begin with certain strings.
> 
> I can easily grep for a line that doesn't start with one string:
> grep -v "^string" /path/to/filename
> 
> But can I do the same in one command, searching for each line that 
> doesn't begin with "string" or "string2" or "string3"?

$ cat test
apple
orange
grape
linux
$ grep -v '^\(apple\|orange\|grape\)' test 
linux
$ grep -E -v '^(apple|orange|grape)' test 
linux
$ egrep -v '^(apple|orange|grape)' test 
linux


-- 
~'`^`'~=-.,__,.-=~'`^`'~=-.,__,.-=~'`^`'~=-., \|/  (___)  \|/ _,.-=~'`^`
                                               @~./'O o`\.~@
               "Knowledge is Power"           /__( \___/ )__\  *PPPFFBT!*
                  -- Francis Bacon               `\__`U_/'
 _,.-=~'`^`'~=-.,__,.-=~'`^`'~=-.,__,.-=~'`^`'~= <____|'  ^^`'~=-.,__,.-=
~`'^`'~=-.,__,.-=~'`^`'~=-.,__,.-=~'`^`'~=-.,__,.-==--^'~=-.,__,.-=~'`^`



More information about the wplug mailing list