find . -type f -name "*.R" -exec sed -i 's/foo/bar/g' {} + # replaces all strings that match 'foo' with 'bar' in files that are called something .R (recursive)