Tag Archive

Search for string in files and replace string in these files only

Published on May 25, 2010 By Ron

Here is a tiny script that I like to use for batch editing files from the shell command line: find . -iname ‘*.php’ | xargs grep ‘oldString’ -sl | xargs sed -i ‘s/oldString/newString/g’ It is a combined command that does the following: Find all files ending in ‘.php’ in the current folder or below and […]