Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have an xml document in the format below:

  <key>value</key>
  <key>value</key>
  <key>value</key>

But need to convert it to the following:

  <tag k='key' v='value' />
  <tag k='key' v='value' />
  <tag k='key' v='value' />

The original xml file is roughly 20,000 lines long, so I'm keen to automate as much as possible! I've looked at xmlstarlet, but drew a blank with it. Presumably it would be a good place to start though? Help gratefully received, thanks.

share|improve this question
1  
I think this should be in stackoverflow.com – Srini Jun 18 '12 at 9:32
See this question for command line solutions: askubuntu.com/questions/100764/… – Takkat Jun 18 '12 at 10:04

closed as off topic by fossfreedom Jun 18 '12 at 20:34

Questions on Ask Ubuntu are expected to relate to Ubuntu within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

Browse other questions tagged or ask your own question.