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 🙂

Previous articleAtom feeds with PHP 5 Dom and XSL
Next articleUbuntu and webcams
Hi, I'm Rus and after 10 years of Linux administration and software development, in September 2014 I quit my day job, sold all my stuff and moved to Thailand to live the good life. My new website, shows how I'm making money online as well as what life can be like when you're not sat behind a desk and are free to make your own decisions!