Search code examples
linuxsedsunos

sed: command garbled in SunOS


I am running following sed command to replace something in xml file.

sed -e '/<AddName>/{ s;<AddName>;<ModifyName>;}' ${modified_name_file} > ${RESOURCES}/tempfile2.xml

This works fine in Linux but fails in Solaris with following error.

sed: command garbled: /<AddName>/{ s;<AddName>;<ModifyName>;}

I am having hard time to figure this out. Is there any other way to do this in SunOS?


Solution

  • Use:

    sed '/<AddName>/{ s/<AddName>/<ModifyName>/;}' ${modified_name_file} > ${RESOURCES}/tempfile2.xml