Saturday, September 4, 2010

Script :Find and Replace word from files.

Script for Replace the One word with another word from all files place in present directory.

And also take backup of old files.

Step to use :
> Copy the below script in file
> Change the permission of file $chmod u+x filename
> Run this ./filename
> FindWord is word to find and replace With ReplaceWord
{
for fl in *.php; do
mv $fl $fl.old
sed 's/FindWord::/ReplaceWord::/g' $fl.old > $fl
done
}

No comments:

Post a Comment