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

  • 1
    MSYS2
    MSYS2
    MSYS2 is a collection of tools and
    libraries providing you with an
    easy-to-use environment for building,
    installing and running native Windows
    software. It con...
    Download MSYS2
  • 2
    libjpeg-turbo
    libjpeg-turbo
    libjpeg-turbo is a JPEG image codec
    that uses SIMD instructions (MMX, SSE2,
    NEON, AltiVec) to accelerate baseline
    JPEG compression and decompression on
    x86, x8...
    Download libjpeg-turbo
  • 3
    Xtreme Download Manager
    Xtreme Download Manager
    The project has a new home now:
    https://xtremedownloadmanager.com/ For
    developers:
    https://github.com/subhra74/xdm Xtreme
    Download Manager is a powerful tool t...
    Download Xtreme Download Manager
  • 4
    TTGO VGA32 Lite
    TTGO VGA32 Lite
    Features:4:3 and 16:9 low resolution
    VGA outputPS/2 keyboard and mouse
    inputText-based user interface (TUI)
    with dialog managerPartial Unicode
    supportSlave dis...
    Download TTGO VGA32 Lite
  • 5
    Clover EFI bootloader
    Clover EFI bootloader
    Project has moved to
    https://github.com/CloverHackyColor/CloverBootloader..
    Features:Boot macOS, Windows, and Linux
    in UEFI or legacy mode on Mac or PC with
    UE...
    Download Clover EFI bootloader
  • 6
    unitedrpms
    unitedrpms
    Join us in Gitter!
    https://gitter.im/unitedrpms-people/Lobby
    Enable the URPMS repository in your
    system -
    https://github.com/UnitedRPMs/unitedrpms.github.io/bl...
    Download unitedrpms
  • More »

Linux commands

Ad