Sunday, 15 August 2010

How to search the specified files for text matching

To search the specified files for text matching the specified pattern  and print matching lines. The -i option specifies that matching is performed without regard to case. The -n option specifies that each line of output is preceded by the file name and line number. The -v option reverses the matching, causing non-matched lines to be printed.





    $ grep pattern files
    $ grep -i pattern files
    $ grep -n pattern files
    $ grep -v pattern files

No comments:

Post a Comment