Select all elements matching "XPATH1" and print the value of their sub-element "XPATH2"

xml select

  • Select from XML documents using XPATHs.
    Tip: use `xml elements` to display the XPATHs of an XML document.
    More information: <http://xmlstar.sourceforge.net/docs.php>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

xml select --template --match "{{XPATH1}}" --value-of "{{XPATH2}}" {{path/to/input.xml|URI}}

click the source code to copy install xml select on any operating system with command-not-found.com