Find all files ending with .txt in the current directory and its subdirectories, and replace all occurrences of "oldtext" with "newtext" in each file.
find ~ -name *\.txt -exec xargs sed -i 's/oldtext/newtext/g' {} \;