Periodically I need to replace a string in multiple files on Linux. I find myself looking up this command or a variant every time.
grep -rl OLDSTRING *.FILEEXTENSION | xargs perl -pi~ -e 's/OLDSTRING/NEWSTRING/'
A coder’s daily explorations through PHP, Java, CSS, JavaScript, Linux, OS X, Apache, Tomcat, and everything else.
{ 2007 10 01 }
Periodically I need to replace a string in multiple files on Linux. I find myself looking up this command or a variant every time.
grep -rl OLDSTRING *.FILEEXTENSION | xargs perl -pi~ -e 's/OLDSTRING/NEWSTRING/'
Post a Comment