我想知道使用 shellscript 解析 XML 文件的最佳方法是什么?
如果你已经做到了,如果你能告诉我你是怎么做到的
最佳答案
你可以试试xmllint
The xmllint program parses one or more XML files, specified on the command line as xmlfile. It prints various types of output, depending upon the options selected. It is useful for detecting errors both in XML code and in the XML parser itse
它允许您通过 xpath 选择 XML 文档中的元素,使用 --pattern 选项。
在 Mac OS X (Yosemite) 上,默认安装。
在 Ubuntu 上,如果尚未安装,您可以运行 apt-get install libxml2-utils
https://stackoverflow.com/questions/4680143/