Sed regex change of file -
i (unsuccessfully) trying substitute database host entry in magento local.xml file (the connection string file).
the line following:
<host><![cdata[localhost]]></host>
i want find line contains "host" sed , replace content of inner brackets else.
note - content of inner brackets won't "localhost", s/localhost/lala/g won't work.
i got following:
sed -i "/\<host\>/s/.../lala/2" local.xml
help please.
with gnu sed:
sed 's|\(<host><!\[cdata\[\).*\(\]\]></host>\)|\1lala\2|' file
or
sed -e 's|(<host><!\[cdata\[).*(\]\]></host>)|\1lala\2|' file
output:
<host><![cdata[lala]]></host>
Comments
Post a Comment