linux grep command – grep multiple patterns

The last article 《grep or condition, grep and condition》 introduced grep and, or use, including the use of the -e parameter.

Here is a detailed description of the use of the -e parameter.

grep one pattern

➜ grep -e "12" test1.txt
➜ grep "12" test1.txt

The results are consistent.

grep two patterns

➜ grep -e "12" -e "linux" test1.txt

grep three patterns

➜ grep -e "12" -e "linux" -e "apple" test1.txt

Multiple patterns and so on.

Grep and condition can also use grep -e parameter.

Add a Comment

Your email address will not be published. Required fields are marked *