Find all files with the extension .txt in the Documents directory and search for the string 'foo' in them, displaying only the names of the files that contain it.
find ~/Documents/ -name *.txt | xargs grep -li 'foo'