Find all files with the extensions .txt or .log and search for the word "error" in them, returning only the names of the files that contain the word.
find ~ \( -name "*.txt" -o -name "*.log" \) | xargs grep -li "error"