linux replace all occurrences of string in files code example
Example 1: linux replace string in files recursively
find . -type f -name "*.txt" -exec sed -i'' -e 's/foo/bar/g' {} +
Example 2: linux replace string in all files
sed -i 's/old-text/new-text/g' input.txt
Example 3: sed replace in file
sed -i 's/foo/bar/g' hello.txt