EnglishFrenchSpanish

OnWorks favicon

xgrep - Online in the Cloud

Run xgrep in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command xgrep that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

PROGRAM:

NAME


xgrep ‐ search content of an XML file

SYNOPSIS


xgrep [-h] [-v] [-t] [-p] [-n nsdef [-n nsdef]...] [-x xpath] [-s string [-s string]...]
[-c catalog-file] [infile [infile]...]

DESCRIPTION


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

OPTIONS


xgrep accepts the following options:

-x xpath
An XPath specification of the elements of interest.

-s string
A custom string format specifying the elements of interest. The string format is
base-element:element/regex/,element/regex/,... where base-element is the name of
the elements within which a match should be attempted, the match succeeding if,
for each element/regex/ pair, the content of an element of that name is matched by
the corresponding regex. If multiple -s flags are specified, a match by any one of
them is returned.

-n nsdef
Define a namespace prefix using the form prefix=namespace.

-c catalog-file
Use the specified catalog file instead of the default.

-p Regular expressions use Perl syntax as implemented in the PCRE library. (This
option only available when xgrep has been linked with the PCRE library.)

-t Text output mode for generating output formatted for subsequent processing by
standard command-line text tools (grep, sed, etc.). Linefeeds are converted to
spaces within each matching node set, and each node set is seperated by a newline.

-h Display usage information

-v Display version information

EXAMPLES


Consider an XML format, for personnel information, in which each person element has
descendant elements called name and hiredate. To find all person elements with "Smith" in
the content of the name element and "2000" in the content of the hiredate element, do:

xgrep -s 'person:name/Smith/,hiredate/2000/' a.xml b.xml

Using XPath to locate elements with a namespace requires use of the -n flag to define a
namespace prefix for use in the XPath. For example to search for "name" elements within a
GPX document, do:

xgrep -n gpx="http://www.topografix.com/GPX/1/1" \
-x '//gpx:name' data.gpx

Use xgrep online using onworks.net services


Free Servers & Workstations

Download Windows & Linux apps

Linux commands

  • 1
    acl_gran
    acl_gran
    rsbac-admin - Rule Set Based Access
    Control DESCRIPTION: rsbac-admin is a
    set of tool used to manage systems using
    a Rule Set Based Access Control (RSBAC)
    kern...
    Run acl_gran
  • 2
    acl_grant
    acl_grant
    rsbac-admin - Rule Set Based Access
    Control DESCRIPTION: rsbac-admin is a
    set of tool used to manage systems using
    a Rule Set Based Access Control (RSBAC)
    kern...
    Run acl_grant
  • 3
    cpbm
    cpbm
    cpbm - a software analysis toolkit
    (originally: CPROVER benchmarking
    framework) ...
    Run cpbm
  • 4
    cpclean
    cpclean
    cpclean - Remove wrong control points
    by statistical methods ...
    Run cpclean
  • 5
    gbget
    gbget
    gbget - Basic data extraction and
    manipulation tool ...
    Run gbget
  • 6
    gbglreg
    gbglreg
    gbglreg - Estimate general linear
    regression model ...
    Run gbglreg
  • More »

Ad