Supplement to the other very good suggestions already posted: make a backup of the whole site (cp -r /var/www /var/wold) and do the editing there. Personally I would then move the modified files under, for instance /var/www/changed and test http://www.sitename.tld/changed to make sure all the scripts work before going live.

careful there! Doing a s/he/him/ on my comment would break "there", and that'd be difficult to fix as simply! Take backups first, and remember sed uses regex, so you have quite a bit of leeway in how you write your parameters.
–
PhoshiOct 14 '09 at 12:17

aren't you trimming off the surrounding < > characters? don't you want s/\<oldfunction\>/\<newfunction\>/g ? or am i not recognizing a std RE element?
–
quack quixoteOct 14 '09 at 13:35

1

Yea, they are word boundaries, I forgot to add them but Phoshi reminded me. Without \< (beginning of word) and \> (end of word), any occurance of the first string will be replaced in the file. Example, if his function is named len, it will also replace the len in strlen and anywhere else len is found in each file regardless if it's a single word or part of a ward, which is not what he wants. You have to make sure you are only replacing complete words, as sed has no knowledge of "words" without them.
–
John TOct 14 '09 at 13:57

i thought it might be but couldn't find a quick sed-regex reference to verify. thanks!
–
quack quixoteOct 14 '09 at 16:25