Find all files with the extension .txt in the directory /dir and execute the command sed to replace the text "old text" with "new text" in each file.
find /dir -name '*.txt' -exec sed -i 's/old text/new text/' {} \;