I need to replace the following:
Code:
<connection>
<host><![CDATA[mysql.old_domain.com]]></host>
<username><![CDATA[old_username]]></username>
<password><![CDATA[old_password]]></password>
<dbname><![CDATA[old_dbname]]></dbname>
<active>1</active>
</connection>
in a file located app/etc/local.xml
with
Code:
<connection>
<host><![CDATA[mysql.new_domain.com]]></host>
<username><![CDATA[new_username]]></username>
<password><![CDATA[new_password]]></password>
<dbname><![CDATA[new_dbname]]></dbname>
<active>1</active>
</connection>
but the host, username,password, and dbname variables are not always the same, so I can't simply replace "old_username" with "new_username", I need to replace the whole line:
<username><![CDATA[
old_username]]></username>
with the new data:
<username><![CDATA[
new_username]]></username>
What's the simplest way to do this from shell?
I need to put this into a script. Is there an easy function for dealing with xml files from bash?
TiA,
-BassKozz