coni
coni

Reputation: 1

Extract values from XML using xmlstarlet

How can I extract using xmlstarlet the local port from this xml example:

<?xml version="1.0"?>
<opmn xmlns="http://www.oracle.com/ias-instance">
<notification-server>
<port local="6101" remote="6200" request="6003"/>
<log-file path="$ORACLE_HOME\opmn\logs\ons.log" level="4" rotation-size="1500000"/>
<ssl enabled="true" wallet-file="$ORACLE_HOME\opmn\conf\ssl.wlt\default"/>
</notification-server>
</opmn>

Upvotes: 0

Views: 749

Answers (1)

npostavs
npostavs

Reputation: 5027

xml sel -N ias=http://www.oracle.com/ias-instance -t -v //ias:port/@local example.xml

Or more precise

xml sel -N ias=http://www.oracle.com/ias-instance -t -v /ias:opmn/ias:notification-server/ias:port/@local example.xml

Upvotes: 1

Related Questions