I have a file "test.xml"
That looks like the below:
CLASS="BAKERS"
GROUP="ABCYYYYY"
TRACK="DASD"
OWNERS="ALPHA"
GROUP="ABCXXXXX"
GROUP="ABCZZZZZ"
GROUP="ABC
_DONE
CLASS="BAKERS"
GROUP="ABCYYYYY_DONE"
TRACK="DASD"
OWNERS="ALPHA"
GROUP="ABCXXXXX_DONE"
GROUP="ABCZZZZZ_DONE"
`sed -i.bkp '/^GROUP="ABC/ s/$/_DONE"/' test.xml`
It's almost that. But $
means end of line so you have to substitute the last "
using "$
instead:
sed -i.bkp '/^GROUP="ABC/ s/"$/_DONE"/' test.xml
you could also specify that there is some blank after the "
with for instance "[ \t]*$