我有一個包含 XML 檔案的檔案,我需要洗掉所有內容,除了以
<?xml version="1.0
并以
</martif>
謝謝
我試過了
sed '/<?xml version=/,$!d' file > result.txt
洗掉 xml 部分之前的所有內容,但要洗掉</martif>到最后,我不知道如何實作。
uj5u.com熱心網友回復:
USe</martif>作為要列印的范圍的結尾。
sed -n '/<?xml version=/,/<\/martif>/p' file.xml > result.txt
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/536332.html
上一篇:python中的檔案名鏈
下一篇:掃描檔案中的特定單詞
