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 liveFinds only live ; does not find liver , lives , lived , and so on. |
| Case-insensitive text | -i | grep -i pondFinds pond , POND , or Pond . |
| File names only | -l | grep -l WaldenFinds files containing Walden , but returns only a list of file names. |
| Number of occurrences only | -c | grep -c WaldenReturns the names of files containing Walden and the number of hits in each file. |
No comments:
Post a Comment