Find all files with the extension .txt in the entire file system and print their names, then search for the string 'foo' in each of those files and print the names of the files that contain it.
find / -type f -name "*.txt" -print0 | xargs -0 grep -l 'foo'