Grep和Sed等价于XML命令行处理 [英] Grep and Sed Equivalent for XML Command Line Processing

查看:142
本文介绍了Grep和Sed等价于XML命令行处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当执行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

这篇关于Grep和Sed等价于XML命令行处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆