Turbo GREP 5.5 Copyright (c) 1992, 2000 Inprise Corporation
Syntax: GREP [-rlcnvidzuwo] searchstring file[s] or @filelist
Options are one or more option characters preceded by "-", and optionally
followed by "+" (turn option on), or "-" (turn it off). The default is "+".
-r+ Regular expression search -l- File names only
-c- match Count only -n- Line numbers
-v- Non-matching lines only -i- Ignore case
-d- Search subdirectories -z- Verbose
-e Next argument is searchstring -w- Word search
-o- UNIX output format Default set: [0-9A-Z_]
-q- Quiet: supress normal output
-u xxx Create a copy of grep named 'xxx' with current options set as default
A regular expression is one or more occurrences of: One or more characters
optionally enclosed in quotes. The following symbols are treated specially:
^ start of line $ end of line
. any character \ quote next character
* match zero or more + match one or more
[aeiou0-9] match a, e, i, o, u, and 0 thru 9 ;
[^aeiou0-9] match anything but a, e, i, o, u, and 0 thru 9
刚刚找到一个 GNU grep version 2.0d 版。
(它包含能直接使用的grep.exe 以及C source code
这是for Windows 的版本，打入 grep.exe -?
D:\OO\_Grep\grep20dw\grep.exe: option requires an argument -- ?
GNU grep version 2.0d
grep [-[[AB] ]<num>] [-[CEFGLSVbchilnqsvwx?]] [-[ef]] <expr> [<files...>]
Grep searches the named input files (or standard input if no files are named, or
the file name - is given) for lines containing a match to the given pattern.
By default, grep prints the matching lines. There are three major variants of
grep, controlled by the following options.
-G Interpret pattern as a basic regular expression (see below). This is
-E Interpret pattern as an extended regular expression (see below).
-F Interpret pattern as a list of fixed strings, separated by newlines,
any of which is to be matched.
In addition, two variant programs egrep and fgrep are available. Egrep is
similiar (but not identical) to "grep -E", and is compatible with the
historical Unix egrep. Fgrep is the same as "grep -F".
All variants of grep understand the following options:
-num Matches will be printed with num lines of leading and trailing
context. However, grep will never print any given line more than once.
-A "num" Print num lines of trailing context after matching lines.
-B "num" Print num lines of leading context before matching lines.
-C Equivalent to -2.
-S Search subdirectories.
-V Print the version number of grep to standard error. This version
number should be included in all bug reports (see below).
-b Print the byte offset within the input file before each line of output.
-c Suppress normal output; instead print a count of matching lines for
each input file. With the -v option (see below), count non-matching
-e "pattern" Use pattern as the pattern; useful to protect patterns
beginning with -.
-f "file" Obtain the pattern from file.
-h Suppress the prefixing of filenames on output when multiple files are
-i Ignore case distinctions in both the pattern and the input files.
-L Suppress normal output; instead print the name of each input file from
which no output would normally have been printed.
-l Suppress normal output; instead print the name of each input file from
which output would normally have been printed.
-n Prefix each line of output with the line number within its input file.
-q Quiet; suppress normal output.
-s Suppress error messages about nonexistent or unreadable files.
-v Invert the sense of matching, to select non-matching lines.
-w Select only those lines containing matches that form whole words. The
test is that the matching substring must either be at the beginning of
the line, or preceded by a non-word constituent character. Similarly,
it must be either at the end of the line or followed by a non-word
constituent character. Word-constituent characters are letters, digits,
and the underscore.
-x Select only those matches that exactly match the whole line.
-? Displays this help.
Win32 port with subdirectory search created by Tim Charron
(full source available at http://www.interlog.com/~tcharron/grep.html)