Q:

Adding some tags between one specific tag opening and closing in linux

Hi i have my config file where i have to add some tags between two tags as show below
<blacklist>

</blacklist>

I need to add some other tags in between these two tags as below
 <blacklist>
<blacklistEntry>
<groupNames>A,B,C<\/groupNames>
<errorCode>0222<\/errorCode>
</blacklistEntry>
</blacklist>

I tried using sed but not able to achieve this. Please help on this

A:

sed -i 's/<blacklist>/<blacklist>\n<blacklistEntry>\n<groupNames>A\,B\,C<\/groupNames>\n<errorCode>0222<\/errorCode>\n<\/blacklistEntry>/g' file.xml 

