xml-select
Query XML documents with XPath
TLDR
Select nodes with XPath
$ xml select -t -v "[//element]" [file.xml]
Extract multiple values$ xml select -t -m "[//item]" -v "[@name]" -n [file.xml]
Select with namespace$ xml select -N [ns=http://example.com] -t -v "[//ns:element]" [file.xml]
Copy matching nodes$ xml select -t -c "[//element]" [file.xml]
SYNOPSIS
xml select [options] xpath [file...]
DESCRIPTION
xml select queries XML documents using XPath expressions. Part of xmlstarlet toolkit. Extracts values, attributes, and node sets from XML files.
PARAMETERS
-t, --template
Start template.-v, --value-of xpath
Output value of XPath expression.-m, --match xpath
Match XPath expression.-c, --copy-of xpath
Copy matching nodes.-n, --nl
Output newline.-N prefix=uri
Define namespace prefix.-T
Text output mode.
SEE ALSO
xml-edit(1), xml-format(1), xmllint(1)
