Find all files with the extension .txt in the home directory and search for the string 'foo' in each of them, displaying the filename with the results.
find $HOME -type f -name '*.txt' | xargs grep -H 'foo'