Created
March 19, 2018 18:39
-
-
Save acbrent25/9afc90a6d59d17b846e939a2ce56425e to your computer and use it in GitHub Desktop.
[Mac Terminal Commands] Grep commands to search anything #grep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment