0
我試圖從數百個XML文件中切出部分。在XML文檔的結構類似於:從XML(xmlstarlet,awk,perl ..)雕刻元素
<document>
<nodes>
<node id=123>pages of txt</node>
<node id-=124>more example pages of txt and sub elements</node>
</nodes></document>
我只是想提取所有<node>
元素。我一直在嘗試使用xmlstarlet:
xmlstarlet sel -t -c 「/document/nodes」
的問題是,它只返回</nodes>
。
我只需要提取下面的例子:
<node id=123>pages of txt</node>
<node id-=124>more example pages of txt and sub elements</node>
誰能推薦一個更好的選擇,工具或方法?非常感謝。
你想要什麼輸出?從你寫的內容來看,你似乎只需要從文件的任一端刪除''和''。 –
Borodin