I am trying to add field at the end of tag using sed script. Suppose I have a tag in XML file:
<book name="Sed tutorial" price="250"/>
Now I want to add field as Book_Width="A" after end of <book/> tag so that my tag becomes:
<book name="Sed tutorial" price="250" Book_Width="A"/>
I tried with sed:
sed '/<book "[^>]*>/ a Book_Width="A"'
but it gives:
<book name="Sed tutorial" price="250"/>
Book_Width="A"