Find all files in the home directory (and its subdirectories) that have the extension .html or .txt and execute the command 'sed -i 's/foo/bar/g' {}' on each of them.
find ~/ -type f \( -name '*.html' -o -name '*.txt' \) -exec sed -i 's/foo/bar/g' {} \;