I have a directory full of XML files that look like this, for which I want to change the value of the "offset" element number from 1 to some other number
$ cat my.xml
<offset xmlns="">1</offset>
I wrote various combinations of this sed command, but nothing I tried runs without an error. I am pretty sure that I need to escape some of the characters, but those that I've tried always end in errors ("unexpected token", "unknown option", etc). I also tried without the -e flag, since it really isn't an expression.
sed -i -e s/<offset xmlns="">1</offset>/<offset xmlns="">99</offset>/ *.xml
Any help would be appreciated.
Best Answer
Try this,
Use a different sed delimiter if the input contain slashes.