How to Grep for Multiple Patterns in Unix

PREV     NEXT

  • 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.

Ex:

  • 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

Share this website !!!
Facebook Twitter Linkedin