I am trying to search all files in a directory (and all subdirectories) for a string. If the file has that string, I then want to search for the number of times another string occurs, in this case "snake" and output it. I would also like to output the lines on which "snake" occurs within the file.
echo "Files with Reptile:"
find . -type f -name "*.txt" -exec grep -l "Reptile" {} \;
My challenge is how I add additional grep commands after the curly brackets. I have tried a couple of things and keep getting a "missing argument to -exec" error.
Am I trying to stuff too much into this find?
Thanks