grep exclude multiple strings
Two examples of filtering out multiple lines with grep:
Put this in filename.txt
:
abc
def
ghi
jkl
grep command using -E option with a pipe between tokens in a string:
grep -Ev 'def|jkl' filename.txt
prints:
abc
ghi
Command using -v option with pipe between tokens surrounded by parens:
egrep -v '(def|jkl)' filename.txt
prints:
abc
ghi
grep -Fv -e 'Nopaging the limit is' -e 'keyword to remove is'
-F
matches by literal strings (instead of regex)
-v
inverts the match
-e
allows for multiple search patterns (all literal and inverted)