Select node by its text value in xmlstarlet

后端 未结 2 1262
借酒劲吻你
借酒劲吻你 2021-01-05 10:19

I am trying to extract the value of the \'Value\' node, where the \'Key\' node is \'state\' within a bash shell:



        
2条回答
  •  时光说笑
    2021-01-05 10:50

    This XPath will select Value of a State based on its Key equalling state:

    /FrontendStatus/State/String[Key='state']/Value
    

    Or, in xmlstarlet:

    $ xmlstarlet sel -t -m "/FrontendStatus/State/String[Key='state']" -v Value 

    Will return WatchingLiveTV as requested.

提交回复
热议问题