Last Updated: February 25, 2016
·
206
· MasseR

Finding data from XML with command-line

You can use xmllint from libxml and xmlstarlet to run queries against XML-files. Personally I prefer xmlstarlet, because it accepts XML namespaces on command-line, whereas xmllint needs to start a shell if you want namespaces.

  • curl reddit.com/r/programming.rss | xmllint --xpath '//item/title'
  • curl reddit.com/r/programming.rss | xmllint sel -t -v '//item/title'