grep
Look for a string of text within several files in a folder
sh
grep -nr '<string>' <path>Where:
-n: show the line number of the match-r: recurse into sub-directories'<string>'looks for instances of<string>in your files- there is additional matching control and regular expressions you can use to fine-tune this
<path>: looks at the files in this directory and all sub-directories
Example:
sh
grep -nr 'foobar' my-project/lib/my-project/lib/file_one.txt:17:There is a foobar in here
my-project/lib/nested/folder/file_two.txt:42:I found a foober here too- Credit: https://stackoverflow.com/a/4121821
- Grep manual: https://www.gnu.org/software/grep/manual/grep.html