Em XPATH @
aponta para um nome de atributo.
Para gerar registros csv com base nos valores dos atributos de cada nó <row>
, use a seguinte abordagem:
xmlstarlet sel -T -t -m 'badges/row' -v \
'concat(@Id, ",", @UserId, ",", @Name, ",", translate(@Date," ",""),
",", @Class, ",", @TagBased)' -n Badges.xml
A saída:
1,1,Autobiographer,2016-08-02T15:56:07.133,3,False
2,8,Autobiographer,2016-08-02T15:56:07.133,3,False
3,9,Autobiographer,2016-08-02T15:56:07.133,3,False
4,19,Autobiographer,2016-08-02T15:56:07.133,3,False
5,27,Autobiographer,2016-08-02T15:56:07.133,3,False