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’.

This entry was posted in Linux, Scripts. Bookmark the permalink.

One Response to 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 *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>