我在某个位置获得了一个xml' http://10.xxx.xxx.xx:8080/mbci/collection1/dataimport?command=status'其中包含格式的xml数据。
<response>
<lst name="responseHeader">
<int name="status">
0
</int>
<int name="QTime">
0
</int>
</lst>
<lst name="initArgs">
<lst name="defaults">
<str name="config">
data-config.xml
</str>
</lst>
</lst>
<str name="command">
status
</str>
<str name="status">
idle
</str>
<str name="importResponse">
A command is still running...
</str>
<lst name="statusMessages">
<str name="Time Elapsed">
0:2:13.132
</str>
<str name="Total Requests made to DataSource">
6
</str>
<str name="Total Rows Fetched">
755949
</str>
<str name="Total Documents Skipped">
0
</str>
<str name="Full Dump Started">
2014-11-18 04:00:18
</str>
</lst>
<str name="WARNING">
This response format is experimental. It is likely to change in the future.
</str>
</response>
我应该得到&#39;&#39;它的价值。我无法找到一个直接的方法,所以我下载文件,然后使用以下脚本解析xml
wget http://10.xxx.xxx.xx:8080/mbci/collection1/dataimport?command=status -O status.xml
status=$(grep -oP '(?<="status">).*(?=</str)' status.xml)
但我需要知道有没有其他更简单的方法来做,而不是下载和解析