Last Updated: February 25, 2016
·
191
· MasseR

Formatting XML on command-line

You can use xmllint from libxml or xmlstarlet to format XML. Take for example curl http://www.reddit.com/r/programming.rss which returns an RSS-feed in one line, completely unreadable.

Try doing curl http://www.reddit.com/r/programming.rss | xmllint --format - instead to get a nicely formatted xml

You can also do curl http://www.reddit.com/r/programming.rss | xmlstarlet fo which I prefer personally, but it might not be installed beforehand.