ich meine Ausgabe drucken möchten mit einem Newline trennen, so dass ich versucht:Wie Newline innerhalb concat von xmlstarlet
xmlstarlet sel -t -m "//node01" -v 'concat(@title,"\n",script/code)' -n input.xml
jedoch, was gedruckt wird, ist das „\ n“ wörtliche Wert und der Ausgang ist auf gleiche Linie. Wie erzwinge ich einen Newline innerhalb der concat() - Funktion?
Eine Probe input.xml ist:
<test>
<aaa>This is a test</aaa>
<node01 title="howdy">
<script>
<code>function idoit() {
console.log("hello world");
}
</code>
</script>
</node01>
</test>
Und wenn ich laufe, ist der Ausgang:
howdy\nfunction idoit() {
console.log("hello world");
}
Was passiert, wenn Sie 'concat versuchen (@title," ", Skript/Code)'? Ist es nicht so, dass xmlstarlet etwas XSLT aus Ihrer Eingabe erstellt, wo dann vielleicht die Zeichenreferenz funktioniert? –
Hallo Martin, netter Tipp, aber ich habe versucht, es funktioniert nicht. – ifelsemonkey