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 can't 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.

  • 5
    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

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

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.