|
replace string in XML with sed
Greetings,
I have an XML : file.xml
Code:
<component>
<name>abcd</name>
<value>1234</value>
</component>
I am using sed to replace abcd with the desired value dynamically without knowing the actual value.
Code:
sed 's/<name>[-[:alnum:]./]\{1,\}<\/name>/<name>ijkl<\/name>/' file.xml > newfile.xml
I don't have any issues with this command in Linux but on Solaris machine, I am getting the error:
Quote:
|
sed: command garbled: /<name>[-[:alnum:]./]\{1,\}<\/name>/<name>ijkl<\/name>/
|
If I remove >[-[:alnum:]./]\{1,\} and put the actual value, it is fine. But I have do it dynamically as I use it within the script to replace the existing value with the given value.
Can somebody please advise.
Thanks,
Chiru
Last edited by Yogesh Sawant; 04-08-2008 at 02:45 PM..
Reason: added code tags
|