I want to find and replace a string for another in a whole directory of files. Pretty simple really.
I have access to PHP, linux commands and Windows software.
Any simple suggestions?
Global Find Replace Whole Directory
Moderator: General Moderators
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
Be sure to chmod a+x it..
replace.sh
replace.sh
Code: Select all
for fl in *.php; do
mv $fl $fl.old
sed 's/OsisForm/OF/g' $fl.old > $fl
#rm -f $fl.old
done- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK