This is very useful command especially when you need to find a file with specific string inside it.
I normally use this command to find out my script which was misplaced in file system.
grep -r 'text to search for' /path/to/dir
Below command is not checked but seems to be working.
grep -oHnr "some pattern" *.txt
-o print Only the matched parts of a matching line, with each part on a separate line. -H print the filename for each match.
-n prefix each line of output with the 1 based line number.
-R, -r recursively read all files under subdirectories.