Using sed to replace all strings in a file

As part of our test environment rebuild one of the first things we tackled was moving the databases to the new virtual environment, this means changing the database address in a lot of config files, fortunately sed makes this job really easy!


sed -i s/olddatabase/newdatabase/g *.xml

We’re also using CNAMEs now for the addresses to make this change a lot easier next time the database moves hardware 🙂

Leave a Reply

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