Tag Archives: sed

Replace a string in all files recursively within a directory

Power of NIX: find /some/dir -type f | xargs sed -i ‘s|string1|string2|’ Even stronger, replace a string in all files that match a regex: grep -rlE “^regexhere$” /some/dir | xargs sed -i ‘s|string1|string2|’ Note that grep uses POSIX regex, not perl-like regex. But i think POSIX regex is sufficient for most cases. Or you can [...]