search

  • The grep command searches the given input FILEs for lines containing a match or a text string.

    grep command syntax

    The syntax is:

    grep -options "text string to search” directory-path

    OR

    grep [option] "text string to search” directory-path

    OR

    grep -r "text string to search” directory-path

    OR

    grep -r -H "text string to search” directory-path

    OR

    egrep -R "word-1|word-2” directory-path

    OR

    egrep -w -R "word-1|word-2” directory-path