Find all directories with the file extension ".txt" in the current directory and its subdirectories, and search for the string "search" in all of them.
find ~ -type d -name '*.txt' | xargs grep -Rl "search"