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