Created
September 23, 2011 13:59
-
-
Save gregawoods/1237406 to your computer and use it in GitHub Desktop.
Search a directory for PHP files and replace instances of split() with explode()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for file in $(egrep --include=*.php -rl "([^a-zA-Z_]+)split\(" .) | |
do | |
# you might replace 'preg_split' with 'explode' if you don't require regex support | |
sed -E "s/([^a-zA-Z_]+)split\(/\1preg_split\(/g" $file > /tmp/tempfile.tmp | |
mv /tmp/tempfile.tmp $file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment