Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a pipe-friendly program that takes:

  • An XML document
  • An XPath expression indicating the target element(s)
  • The desired replacement

? Something like sed but knowledgeable about XML (elements, whitespace, etc.)?

share|improve this question

If you don't mind using/learning XSLT, there is the xsltproc utility which can accomplish this.

share|improve this answer

XMLSH has a command xed that might fit your parameters.

xed evaluate an xpath expression and edits every matching node outputing the result document

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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