x

How to Grep for Multiple Patterns in Unix

PREV     NEXT

How to Grep for Multiple Patterns in Unix:


  • Using grep command in Unix, we can find multiple search patterns to find the matching files.
  • Either we can provide the file name to grep or we can give “*.*” which will search from all files under the directory. We need to provide the search patterns within single quotes with pipe separated each other.

Example for How to Grep for Multiple Patterns in Unix:


  • Another way of searching multiple patterns,
  • We can give multiple patterns with pipe separated when we use “-E” as an argument. Otherwise we can give “-e” separately for every pattern.

Ex:

PREV     NEXT



Like it? Please Spread the word!