Skip to content

"grep" command examples

Multiple patterns:

grep 'foo\|bar' *.txt
grep -E 'foo|bar' *.txt
grep -e foo -e bar *.txt

Each pattern in a file on a new line:

grep -f patterns.txt *.txt