grep- Fine-Tune Your Searches
To Find… | Use This Option | Example |
---|---|---|
Text in subfolders | -r | grep -r Walden ~/Documents/* Finds Walden in any file in any subfolder of ~/Documents. |
Whole words only | -w | grep -w live Finds only live ; does not find liver , lives , lived , and so on. |
Case-insensitive text | -i | grep -i pond Finds pond , POND , or Pond . |
File names only | -l | grep -l Walden Finds files containing Walden , but returns only a list of file names. |
Number of occurrences only | -c | grep -c Walden Returns the names of files containing Walden and the number of hits in each file. |
No comments:
Post a Comment