October 26, 2014

Grep - Find a text in file (Unix/Linux)


To find the text files containing a particular string :

grep -l "maheeka" *.txt

Search in current directory :
grep -lr "maheeka" . 

To view the occurrences of the string in the files, use without "-l" option

Reference:
http://hints.macworld.com/article.php?story=20001105214242629

No comments:

Post a Comment