1xgrep(1)                    General Commands Manual                   xgrep(1)
2
3
4

NAME

6       xgrep ‐ search content of an XML file
7

SYNOPSIS

9       xgrep  [-h]  [-v] [-p] [-c catalog-file] [-x xpath] [-s string] ... [-s
10       string] [infile] [infile] ...
11

DESCRIPTION

13       xgrep provides facilities for  searching  content  in  XML  files.  The
14       search  is  specified  either  as an XPath via the -x flag, or a custom
15       syntax including extended regular expressions via the -s flag.   Multi‐
16       ple  input  files may be specified; if none are provided, input is read
17       from stdin.
18

OPTIONS

20       xgrep accepts the following options:
21
22       -x xpath
23               An XPath specification of the elements of interest.
24
25       -s string
26               A custom string format specifying the elements of interest. The
27               string format is base-element:element/regex/,element/regex/,...
28               where base-element is the name of the elements within  which  a
29               match  should  be  attempted, the match succeeding if, for each
30               element/regex/ pair, the content of an element of that name  is
31               matched  by  the  corresponding regex. If multiple -s flags are
32               specified, a match by any one of them is returned.
33
34       -c catalog-file
35               Use the specified catalog file instead of the default.
36
37       -p      Regular expressions use Perl syntax as implemented in the  PCRE
38               library. (This option only available when xgrep has been linked
39               with the PCRE library.)
40
41       -h      Display usage information
42
43       -v      Display version information
44

EXAMPLES

46       Consider an XML format, for personnel information, in which each person
47       element  has  descendant elements called name and hiredate. To find all
48       person elements with "Smith" in the content of  the  name  element  and
49       "2000" in the content of the hiredate element, do:
50
51           xgrep -s 'person:name/Smith/,hiredate/2000/' a.xml b.xml
52

SEE ALSO

54       regex(7), pcre(3), xmllint(1)
55

AUTHOR

57       Brendt Wohlberg <software@wohlberg.net>
58
59
60
61                                 17 July 2007                         xgrep(1)
Impressum