用于 XML 命令行处理的 Grep 和 Sed 等效项 [英] Grep and Sed Equivalent for XML Command Line Processing
问题描述
在编写 shell 脚本时,通常数据将位于 csv 等单行记录文件中.用grep
和sed
处理这些数据真的很简单.但是我必须经常处理 XML,所以我非常想要一种通过命令行脚本访问 XML 数据的方法.最好的工具是什么?
When doing shell scripting, typically data will be in files of single line records like csv. It's really simple to handle this data with grep
and sed
. But I have to deal with XML often, so I'd really like a way to script access to that XML data via the command line. What are the best tools?
推荐答案
我发现 xmlstarlet 非常擅长这类事情.
I've found xmlstarlet to be pretty good at this sort of thing.
http://xmlstar.sourceforge.net/
也应该在大多数发行版存储库中可用.介绍性教程在这里:
Should be available in most distro repositories, too. An introductory tutorial is here:
http://www.ibm.com/developerworks/library/x-starlet.html
这篇关于用于 XML 命令行处理的 Grep 和 Sed 等效项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!