linux replace string in files recursively 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: linux replace string in files recursively
find /home/www \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i 's/subdomainA\.example\.com/subdomainB.example.com/g'