grep exclude multiple strings

grep, linux, ubuntu

Solution

Filtering out multiple lines with `grep`:

Put these lines in `filename.txt` to test:

abc
def
ghi
jkl

`grep` command using `-E` flag with a pipe between tokens in a string:

grep -Ev 'def|jkl' filename.txt

prints:

abc
ghi

egrep using `-v` flag with pipe between tokens surrounded by parens:

egrep -v '(def|jkl)' filename.txt

prints:

abc
ghi

Or if stacking `-e` flags through `grep` parameters is okay (credit -> `@Frizlab`):

grep -Fv -e def -e jkl filename.txt

prints:

abc
ghi

Problem

I am trying to see a log file using `tail -f` and want to exclude all lines containing the following strings: `Nopaging the limit is` and `keyword to remove is` I am able to exclude one string like this: ``` tail -f admin.log|grep -v "Nopaging the limit is" ``` But how do I exclude lines containing either of `string1` or `string2`?

Original source