Question #511   Submitted by Answiki on 07/10/2021 at 03:38:41 PM UTC

On Linux, how to grep for two patterns?

Answer   Submitted by Answiki on 07/10/2021 at 03:41:33 PM UTC

On Linux, you can grep for several patterns with the following syntaxes:

grep -e 'pattern1' -e 'pattern2' file.txt

or:

grep 'pattern1\|pattern2\|pattern3' file.txt


2 events in history
Answer by Answiki on 07/10/2021 at 03:41:33 PM

On Linux, you can grep for several patterns with the following syntaxes:

grep -e 'pattern1' -e 'pattern2' file.txt

or:

grep 'pattern1\|pattern2\|pattern3' file.txt


Question by Answiki 07/10/2021 at 03:38:41 PM
On Linux, how to grep for two patterns?

Icons proudly provided by Friconix.