Find all files with a ".txt" extension in the current directory and its subdirectories, and replace all occurrences of "badword" with "goodword" in those files.
find ~ -type f -name "*.txt" | xargs sed -i 's/badword/goodword/g'