Find all files with the extension .txt in the current directory and its subdirectories, and for each of those files, search for the string "foo" and print the name of the file if it is found.
find ./ -name '*.txt' | xargs -I {} grep -l foo {}