I use this command to find all files of a given type in a given directory which that contain a given string:
find /path/to/dir/ -name "*.php" -exec grep -l "my string" {} \;
However it only returns the file names. Is it possible that it could also return all line numbers where matches were found and (for bonus points) a preview of each line? If so, would this be significantly slower?
Secondly, how could I make it work with multiple file types?