tags:

views:

8

answers:

0

Here is the xml snippet:

$ 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>

The desired output is:

yahoo.com | ir1.fp.vip.sp2.yahoo.com
Inc.com | www.inc.com

What I have so far that is only partially working: $ xml sel -t -m "//hostname" -v "@name" -n short.xml

I cannot seem to trap the Type= condition properly. TIA.