XML-Datei in CSV in Shell-Skript konvertieren?
Ich versuche, eine XML-Datei in eine CSV-Datei zu konvertieren. Ich habe eine Eingabe-XML-Datei wie folgt:
<Row>
<Cell>
<Data Type="String" >START</Data>
</Cell>
<Cell>
<Data Type="DateTime" >2013-01-15T21:30:42</Data>
</Cell>
<Cell>
<Data Type="String" ></Data>
</Cell>
<Cell>
<Data Type="String" >Start 'suite8'</Data>
</Cell>
<Cell>
<Data Type="String" >Test 'suite8' started</Data>
</Cell>
<Cell>
<Data Type="String" ></Data>
</Cell>
</Row>
<Row/>
<Row>
<Cell>
<Data Type="String" >START_TEST_CASE</Data>
</Cell>
<Cell>
<Data Type="DateTime" >2013-01-15T21:30:42</Data>
</Cell>
<Cell>
<Data Type="String" ></Data>
</Cell>
<Cell>
<Data Type="String" >Start 'case1'</Data>
</Cell>
<Cell>
<Data Type="String" >Test Case 'case1' started</Data>
</Cell>
<Cell>
<Data Type="String" >case1</Data>
</Cell>
</Row>
Ich interessiere mich für die Teile zwischen den Tags<Data Type="String" >
und</Data>
. Außerdem sollte beim Tag eine neue Zeile gestartet werden<Row>
erscheint.
Die gewünschte Ausgabe-CSV-Datei sollte folgendermaßen aussehen:
START,2013-01-15T21:30:42,,Test 'suite8' started
START_TEST_CASE,2013-01-15T21:30:42,,Start 'case1',Test Case 'case1' started,case1
Ich hoffe das ist klar genug, jede Hilfe wird sehr geschätzt :) Danke!