Created
May 19, 2020 08:55
-
-
Save tizee/b6faa4b50d009ee809b3dd19daf4a174 to your computer and use it in GitHub Desktop.
find files containing specific text
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
# reference https://stackoverflow.com/questions/16956810/how-do-i-find-all-files-containing-specific-text-on-linux | |
## 1. grep | |
grep -rnw '/path/to/somewhere/' -e 'pattern' | |
## 2. ack | |
ack 'text-to-find-here' | |
## 3. grep with find | |
find . -name '*.js' -exec grep -i 'string to search for' {} \; -print | |
# or | |
find . -type f -exec grep -l "Apache License" {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment