LinuxCLIツールのみを使用してXMLファイルを処理しようとしています。私が解決しようとしている主な問題は、次のように、特定のXMLタグの内容を新しいタグにコピーすることです。
<date>Wednesday</date>
<name>The Name</name>
<anotherattribute>Attribute</anotherattribute>
の中へ:
<date>Wednesday</date>
<id>The Name</id>
<name>The Name</name>
<anotherattribute>Attribute</anotherattribute>
私はこの問題を解決するためにsedを使用しようとしており、タグを識別してホールドバッファーにコピーすることができました。
/<name>/{
h
i\
<id>
G
a\
</id>
}
しかし、その結果は次のようになります。
<date>Wednesday</date>
<id>
<name>The Name</name>
<name>The Name</name>
</id>
<anotherattribute>Attribute</anotherattribute>
どんな助けでも大歓迎です。