Want to use sed to add some parameters at the end of the line

Hello All,

I have a doubt in sed, i want to add some parameter at the end of the tag inside a xml tag. how to i do that. so i want to add Results="true" value="high" inside the xml tag.

Orignal
<execute description="reboot">
<execute description="Stop Servlet">

After adding the parameters:-
<execute description="reboot" Results="true" value="high">
<execute description="Stop Servlet" Results="true" value="high">

How do i do that.

Thanks
Adsi

sed 's/>/ Results="true" value="high">/'

This does not changes the things inside the xml file permanently. It just print the changes in the Command line. What changes should i make.I am enclosing my script below, when i pass the xml file to be modified from the command line.

#!/bin/sh

usage() {
 $ECHO "Usage: [not perfect]"
}

if [ $# -eq 0 ]; then
  usage
  exit 0
fi

cat $1 | grep "execute description=" |  sed 's/>/ Results="true" value="h
igh">/'



if [ $# -ne 1 ];
 then
 usage
 exit 1
 fi

UUOC.

Redirect the output to a file:

grep "execute description=" "$1" | sed 's/>/ Results="true" value="high">/' > newfile

Oops, that was a dumb question, that worked but xml file now just has:-

<execute description="reboot" Results="true" value="high">
<execute description="Stop Servlet" Results="true" value="high">

where as it should be:-

<?xml version="1.0" encoding="UTF-8"?>
<start>
<execute description="reboot" Results="true" value="high">
<execute description="Stop Servlet" Results="true" value="high">
</start>

How could i fix this?

Thanks
Adsi

Why should it be? You used grep, which will only print the matching lines.

sed '/^<execute/ s/>/ Results="true" value="high">/' "$1" > newfile