Reputation: 7563
I am trying to format a xml file using xmlstarlet but I don't want to create a new xml file.
I tried this
xmlstarlet fo --inplace --indent-tab --omit-decl project_00.xml
but the parameter --inplace
is not allowed to the fo
(format) command.
Does anyone know how I do this?
Upvotes: 5
Views: 4669
Reputation: 155
You could use this one liner
xmlstarlet ed -L -O project_00.xml
Reference http://xmlstar.sourceforge.net/doc/UG/xmlstarlet-ug.html#idm47077139594320
Upvotes: 6
Reputation: 5027
The fo subcommand always writes to stdout, so you would have to patch xmlstarlet.
Otherwise
TMP_XML=$(mktemp)
xmlstarlet fo --indent-tab --omit-decl project_00.xml > "$TMP_XML"
mv "$TMP_XML" project_00.xml
Upvotes: 7