I am working on annotating images using xml. I am using xmlstarlet and unix bash commands but I am facing some issues when I try to append a value to an existing xml attribute value. For example, I have <filename>a</filename>
and I want to make it <filename>a.jpg</filename>
(i.e. concatenate '.jpg' to the existing value).
I used the following piece of code but it totally overwrites the value (i.e. <filename>.jpg</filename>
.
Script:
for name in *.xml; do xmlstarlet ed --inplace -u '/annotation/filename' -v .jpg "$name"; done