Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

What is the ideal way to parse an .xml file into a .csv file that I could include with my shell scripts. I know bash cant do it but I'm unsure if I should try in awk or sed. I imagine a language would be the best solution such as python but I do not know python nor have I touched it.

share|improve this question
As has been argued before parsing tag structured files warrants a real parser. You could e.g. use Ruby and use Nokigiri to parse XML and the class CSV to output CSV. Also, please add a simple example of input and output so that it understandable what you expect from an answer. – N.N. Feb 21 '13 at 16:36
thanks I didn't find that from my search – Darth_Vader Feb 21 '13 at 16:41
up vote 3 down vote accepted

You could use Xmlstarlet (AKA xml) as a XSLT transformer and write a specific CSV transform as mentioned here http://stackoverflow.com/a/952389/1481060

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.