home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 December
/
simtel1292_SIMTEL_1292_Walnut_Creek.iso
/
msdos
/
txtutl
/
ggrep.arc
/
GGREP.HLP
< prev
next >
Wrap
Text File
|
1987-07-20
|
6KB
|
127 lines
.PAGE.
NAME
ggrep - search files for a pattern
SYNOPSIS
ggrep [ options ] [ pattern ] [ files ]
DESCRIPTION
This program is similar to the UNIX fgrep and egrep programs.
It's command-line syntax is almost identical, with only a few
minor exceptions. Unlike UNIX's grep programs, this program
handles both the fgrep and egrep cases (ergo E-, F-, G-grep).
This program searches the input files (or standard input if
no files are specified) for lines matching the pattern. Unless
modified by options, each line found which matches the pattern
is written to the standard output. Normally, the pattern is
a fixed string (like fgrep). It is possible to request the
pattern be interpreted as a regular expression (like egrep).
.PAGE.
DESCRIPTION (continued)
-v All lines but those matching the pattern are output.
-x Only lines matched in their entirety are output.
-a Only lines beginning with the pattern are output [NOTE].
-c Only a count of matching lines is output
-l Only the names of each file, once, with matching lines are
output. Each filename is on a line by itself.
-n Each output line is preceded by its relative line number
-b Each output line is preceded by the block number in which
it was found. Blocks are considered to be 512 bytes [NOTE].
-s Error messages regarding files which cannot be opened are
suppressed.
-e The pattern should should be interpreted as a regular
expression. Regular expression matches utilize Henry
Spencer's REGEXP(3) subroutines [NOTE].
-f (followed by a filename). Multiple patterns are contained
in the named file, one per line.
.PAGE.
DESCRIPTION (continued)
Options marked with [NOTE] perform differently from the standard
UNIX package.
In all cases, the filename is output unless the input is the
standard input or there is only one filename specified. If it is
desirable to begin a pattern with a hyphen, the hyphen should be
escaped with a backslash. Certain patterns may be impossible to
enter from the command line due to MS-DOS limitations. To
incorporate spaces into a pattern, the pattern should be enclosed
in double quotes. Unlike UNIX, it is impossible to specify
multiple strings on the command line. The -f option must be used
to search for multiple strings or regular expressions.
.PAGE.
EXIT VALUES
0: matches found
1: no matches found
2: option error or inaccessible file(s)
3: help was output
CAVEATS
Lines longer than 256 bytes, including lines from a pattern
file, are truncated.
Certain combinations of options are illogical, but inconsistencies
are not reported. The last option on the line takes precedence.
-X, -e, and -a are exclusive; -l using stdin may be meaningless.
.PAGE.
REGULAR EXPRESSION SYNTAX
[ Extracted from Henry Spencer's REGEXP(3) documentation.
Copyright (c) University of Toronto. ]
A regular expression is zero or more branches, separated by '|'.
It matches anything that matches one of the branches. [ NOTE
that '|' is difficult to pass as an argument in MS-DOS. ]
A branch is zero or more pieces, concatenated. It matches a match
for the first, followed by a match for the second, etc.
A piece is an atom possibly followed by '*', '+', or '?'. An atom
followed by '*' matches a sequence of 0 or more matches of the
atom. An atom followed by '+' matches a sequence of 1 or more
matches of the atom. An atom followed by '?' matches a match of
the atom, or the null string.
.PAGE.
REGULAR EXPRESSION SYNTAX (continued)
An atom is a regular expression in parentheses (matching a match
for the regular expression), a range (see below), '.' (matching
any single character), '^' (matching the null string at the
beginning of the input string), '$' (matching the null string at
the end of the input string), a '\' followed by a single character
(matching that character), or a single character with no other
significance (matching that character).
A range is a sequence of characters enclosed in '[]'. It normally
matches any single character from the sequence. If the sequence
begins with '^', it matches any single character not from the rest
of the sequence. If two characters in the sequence are separated
by '-', this is shorthand for the full list of ASCII characters
between them (e.g. '[0-9]' matches any decimal digit). To include
a literal ']' in the sequence, make it the first character
(following a possible '^'). To include a literal '-', make it the
first or last character.
.PAGE.
USAGE SUMMARY
GGREP [ options ] [ pattern ] [ files ]
-e: pattern is a regular expression
-a: anchored matches of pattern
-x: exact matches of pattern
-c: output count of matches only
-l: output filenames with matches only
-v: all lines but matching are output
-n: output line numbers are output
-b: block numbers are output
-s: suppress complaints about file open failures
-f fn: load patterns from file named fn
files: one or more files, wildcards allowed