login: root

welcome

Replace string in all files using sed in linux

Replaces all “OLDSTRING” to “NEWSTRING” in all files

$ grep -rl OLDSTRING * | sort | uniq | xargs sed -i -e ‘s/OLDSTRING/NEWSTRING/

or using find:

find */public_html/ -iname '*.php' -exec sed -i -e 's/OLDSTRING/NEWSTRING/' {} \;

Comment

*