Find all files with the extension .txt in the current working directory and execute the command to replace the string "old" with the string "new" for all lines containing the pattern "pattern".
find $(pwd)/* -name "*.txt" -exec sed -i '/pattern/s/old/new/g' {} \;