grep question, how to filter several type of patterns?

Solution 1:

You can escape the pipe and put the pattern in quotes:

grep "aaa\|bbb"

or use -E:

grep -E "aaa|bbb"

or

grep -E aaa\|bbb

Solution 2:

Put "" between your pattern, like egrep "toto|name"