0

I want to remove two strings globally from some xml code. They are:

 </sellingStatus>

and

 <sellingStatus>

I have tried the following unsuccessfully:

sed -i 'sed -i 's/</sellingStatus>//g' file.xml

The slashes and greater than/lesser than symbols cause have caused issues with my attempts so far. How can I remove these strings with the correct syntax?

Thanks

3

It is not always a good idea to sed xml file, however

sed -i -e 's:</sellingStatus>::g' -e 's:<sellingStatus>::g' file.xml

substitute command in sed can be delimited by arbitrary char. (here : )

1

Use s:::g rather than s///g in your example not to escape '/' symbol:

sed -i 's:</\?sellingStatus>::g' file.xml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.