Parsing xml file using Sed

Hi All,

I have this(.xml) file as:

 <!-- define your instance here -->
   <instance name='ins_C2Londondev' user='' group='' fullname='B2%20-%20London%20(dev)' >
      <property>
      </property>
   </instance>

I want output as:

<!-- define your instance here -->
   <instance name='ins_B2Londondev' user='C2_dev' group='sports' fullname='B2%20-%20London%20(dev)' >
            <property>
      </property>
   </instance>

I want to do this using Sed command.Please help as this is vey urgent.

Thanks in advance

Perhaps you could elaborate on your requirements. If all you need is to change name='ins_C2Londondev' to name='ins_B2Londondev', change user='' to user='C2_dev', change group='' to group='sports' regardless of context, then you don't really need any XML parsing. Oh, and if the new values somehow depend on the input, we can't guess what they need to be, so you need to explain that. On the other hand, if you need real XML parsing, sed is not the right tool.

sed -e "s/name='ins_C2Londondev'/name='ins_B2Londondev'/" \
    -e "s/user=''/user='C2_dev'/" -e "s/group=''/group='sports'/" file.xml

First of all thx for your time.This is the complete .xml file:<name>B2 - London</name>
<description>Calculates risk numbers for the global SCT desk and london credit flow desk</description>
<version>1.0</version>
<revision></revision>
<revcomment></revcomment>
<bline>Fixed Income</bline>
<userid>kkinha</userid>

<!-- define your global properties here -->
<property>
<SRC_PATH>/home/B2_dev/grid/B2_RiskEngine_Grid/OvernightLondon/VB2.STABLE</SRC_PATH>
</property>

<!-- define your instance here -->
<instance name='ins_B2Londondev' user='' group='' fullname='B2%20-%20London%20(dev)' >
<!-- ins_B2Londondev = B2 - London (dev) -->
<!-- define your instance specific properties here -->
<property>
</property>
</instance>
<instance name='ins_B2Londonprod' user='' group='' fullname='B2%20-%20London%20(prod)' >
<!-- ins_B2Londonprod = B2 - London (prod) -->
<!-- define your instance specific properties here -->
<property>
</property>
</instance>
<instance name='ins_B2LondonInt' user='' group='' fullname='B2%20-%20London%20(Stage)' >
<!-- ins_B2LondonInt = B2 - London (Stage) -->
<!-- define your instance specific properties here -->
<property>
</property>
</instance>

<component name='Undefined'>
<version>1.0</version>

  &lt;os&gt;Red Hat Enterprise Linux AS 4&lt;/os&gt;

  &lt;os&gt;SunOS 5.8&lt;/os&gt;

  &lt;package&gt;B2_GridComponentInstall&lt;/package&gt;

</component>

<package name='B2_GridComponentInstall'>
<description>Package for deploying B2 - London</description>
<version>1.0</version>

  &lt;dir  src='$\{SRC_PATH\}' dst='/home/$\{user\}' owner='$\{user\}' group='$\{group\}' type='' exclude='' perm='755' option='' /&gt;
  &lt;post&gt;$\{SRC_PATH\}/deployOvernightRiskEngine.bat&lt;/post&gt;
  &lt;auto_home key='$\{user\}' path='/local/0/home/$\{user\}' server='localhost' /&gt;

</package>

</application>

I have to change user='' to user='C2_Dev' , group='' to group='sports' and dst='/home/${user} to dst=$DST_PATH.Where DST_PATH is shell script variable.User and group shd be changed depending on user input i.e instance name for ex. if instance name is ins_B2Londondev then user and group for that instance shd be changed.I am doin like this buts it's giving error:
sed -n \
"/${Instance}/p"\
-e '/instance name/p'\
-e "s/user=''/user='B2_dev'/" -e "s/group=''/group='games'/" B2GridTemplate.xml

Error::Can't open -e
Can't open /instance name/p
Can't open -e
Can't open s/user=''/user='B2_dev'/
Can't open -e
Can't open s/group=''/group='games'/
<instance name='ins_B2Londondev' user='' group='' fullname='B2%20-%20London%20(dev)' >
<!-- ins_B2Londondev = B2 - London (dev) -->

Please help!!!!

Try add another -e after the first -n. I think it requires one for each script snippet, if you have several.