0

如何使用 xmlstarlet 从此 xml 示例中提取本地端口:

<?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>
4

1 回答 1

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

或者更精确

xml sel -N ias=http://www.oracle.com/ias-instance -t -v /ias:opmn/ias:notification-server/ias:port/@local example.xml
于 2012-05-29T20:10:35.357 回答