Convert xml file to csv in shell script?

前端 未结 2 1110
梦谈多话
梦谈多话 2021-01-03 15:29

I\'m trying to convert a xml file to a csv file. I have an input xml file like this:


  
    START

        
相关标签:
2条回答
  • 2021-01-03 15:58

    Take a look at xslt stylesheets and the xsltproc command. If it is just converting unconditionally all data to rows with comma separated values from the cell tags it's a relatively simple stylesheet.

    A quick search yielded this: XML to CSV Using XSLT With a few adaptations to your xml it should do what you need.

    0 讨论(0)
  • 2021-01-03 16:04

    Parsing XML with Bash has been addressed here before:

    How to parse XML in Bash?

    That said it seems like a painful way to live.

    0 讨论(0)
提交回复
热议问题