Global search and replace with sed and find

sed -e 's/old1/new1/g
s/old2/new2/g
s/old3/new3/g' –i $(find / -name '*.php' -o -name '*.include' -o -name '*.inc' -o -name '*.class' -o -name 'ht.access')

‘locate’ would be an alternative to ‘find’.

Posted in Linux, Scripts
One comment on “Global search and replace with sed and find
  1. Chris Green says:

    Nice One Andrew. Glad to see you’re still keeping busy. Been a while since the SP days in Cathcart.

Leave a Reply

Your email address will not be published. Required fields are marked *

*