linux replace string in files recursively

Shell
find . -type f -name "*.txt" -exec sed -i'' -e 's/foo/bar/g' {} +
Source

Also in Shell: