I recently came across a SVG sprite that had been made with svgstore and wanted to get the individual SVG files back.
I’m sure this could be done in a real programming language, but I tried and succeeded with a simple bash script.
This is so I remember the xmlstarlet incantations that I used.
Get a list of the id
s:
xmlstarlet select -t -v "//*/@id" sprite.svg
Extract an SVG:
xmlstarlet select -t -c "//*[@id=\"${ID}\"]" sprite.svg
Rename symbol
to svg
:
xmlstarlet edit --omit-decl --rename '//*[local-name()="symbol"]' -v svg