lxgrep — Find nodes in an XML document that match an XPath query
lxgrep
[
-xmlns[:prefix]=uri
...] [
-l
] [
-w wrapper-qname
] [
query
] [
input-file
...]
lxgrep is an XML version of the well-known unix grep program. Instead of finding lines containing text that matches a regular expression, it finds nodes (usually elements) that match an XPath query. The matching nodes are output separated by line breaks, and if there are multiple input-file arguments then an XML comment containing the file name is output before each set of matches.
The input-file arguments may be URIs instead of filenames. If no input-file arguments are given, standard input is used.
binds a prefix (or the default namespace) to a URI for use in XPath queries.
Instead of listing the matching items themselves just list the names of files that contain matching items.
By default the output will not be a well-formed XML document unless only a single
element matches. The -w
option specifies the name of an
element to be wrapped around the matches so that the result will be well-formed.