这里是XML片段:选择元素,不能完全得到语法正确
$ cat short.xml
<hostnames>
<hostname name="yahoo.com" type="user"/>
<hostname name="ir1.fp.vip.sp2.yahoo.com" type="PTR"/>
</hostnames>
<hostnames>
<hostname name="Inc.com" type="user"/>
<hostname name="www.inc.com" type="PTR"/>
</hostnames>
所需的输出是:
yahoo.com | ir1.fp.vip.sp2.yahoo.com
Inc.com | www.inc.com
我有什么到目前为止该只是部分工作: $ xml sel -t -m“//主机名”-v“@name”-n short.xml
我似乎无法正确捕获Type =条件。 TIA。
这很有帮助。谢谢。 – galaxywatcher 2011-03-05 18:55:05