Annotation of cci/usr/src/man/man1/grep.1, revision 1.1.1.1

1.1       root        1: .TH GREP 1 "11 August 1980"
                      2: .UC 4
                      3: .SH NAME
                      4: grep, egrep, fgrep \- search a file for a pattern
                      5: .SH SYNOPSIS
                      6: .B grep
                      7: [ option ] ...
                      8: expression [ file ] ...
                      9: .LP
                     10: .B egrep 
                     11: [ option ] ...
                     12: [ expression ]
                     13: [ file ] ...
                     14: .LP
                     15: .B fgrep
                     16: [ option ] ...
                     17: [ strings ]
                     18: [ file ]
                     19: .SH DESCRIPTION
                     20: Commands of the
                     21: .I grep
                     22: family search the input
                     23: .I files
                     24: (standard input default) for lines matching a pattern.
                     25: Normally, each line found is copied to the standard output.
                     26: .I Grep
                     27: patterns are limited regular expressions in the style of
                     28: .IR ex (1);
                     29: it uses a compact nondeterministic algorithm.
                     30: .I Egrep
                     31: patterns are full regular expressions; it uses a fast deterministic
                     32: algorithm that sometimes needs exponential space.
                     33: .I Fgrep
                     34: patterns are fixed strings; it is fast and compact.
                     35: The following options are recognized.
                     36: .TP
                     37: .B \-v
                     38: All lines but those matching are printed.
                     39: .TP
                     40: .B \-x
                     41: (Exact) only lines matched in their entirety are printed
                     42: .RI ( fgrep
                     43: only).
                     44: .TP
                     45: .B \-c
                     46: Only a count of matching lines is printed.
                     47: .TP
                     48: .B \-l
                     49: The names of files with matching lines are listed (once) separated by newlines.
                     50: .TP
                     51: .B \-n
                     52: Each line is preceded by its relative line number in the file.
                     53: .TP
                     54: .B \-b
                     55: Each line is preceded by the block number on which it was found.
                     56: This is sometimes useful in locating disk block numbers by context.
                     57: .TP
                     58: .B \-i
                     59: The case of letters is ignored in making comparisons \(em that is, upper and
                     60: lower case are considered identical.  This applies to \fIgrep\fR\| and
                     61: \fIfgrep\fR only.
                     62: .TP
                     63: .B \-s
                     64: Silent mode.  Nothing is printed (except error messages).
                     65: This is useful for checking the error status.
                     66: .TP
                     67: .B \-w
                     68: The expression is searched for as a word
                     69: (as if surrounded by `\e<' and `\e>', see
                     70: .IR ex (1).)
                     71: (\fIgrep\fR\| only)
                     72: .TP
                     73: .BI \-e " expression"
                     74: Same as a simple
                     75: .I expression 
                     76: argument, but useful when the
                     77: .I expression
                     78: begins with a \-.
                     79: .TP
                     80: .BI \-f " file"
                     81: The regular expression
                     82: .RI ( egrep )
                     83: or string list
                     84: .RI ( fgrep ) 
                     85: is taken from the
                     86: .I file.
                     87: .LP
                     88: In all cases the file name is shown if there is more than one input file.
                     89: Care should be taken when using the characters $ * [ ^ | ( ) and \\ in the
                     90: .I expression
                     91: as they are also meaningful to the Shell.  It is safest to enclose the entire
                     92: .I expression
                     93: argument in single quotes \' \'.
                     94: .LP
                     95: .I Fgrep
                     96: searches for lines that contain one of the (newline-separated)
                     97: .I strings.
                     98: .LP
                     99: .I Egrep
                    100: accepts extended regular expressions.
                    101: In the following description `character' excludes newline:
                    102: .IP
                    103: A \e followed by a single character other than newline matches that character.
                    104: .IP
                    105: The character ^ matches the beginning of a line.
                    106: .IP
                    107: The character $ matches the end of a line.
                    108: .IP
                    109: A 
                    110: .B .
                    111: (period) matches any character.
                    112: .IP
                    113: A single character not otherwise endowed with special
                    114: meaning matches that character.
                    115: .IP
                    116: A string enclosed in brackets [\|] matches any single character from the string.
                    117: Ranges of ASCII character codes may be abbreviated as in `a\-z0\-9'.
                    118: A ]
                    119: may occur only as the first character of the string.
                    120: A literal \- must be placed where it can't be mistaken as a range indicator.
                    121: .IP
                    122: A regular expression followed by an * (asterisk) matches a sequence of 0
                    123: or more matches of the regular expression.
                    124: A regular expression followed by a + (plus) matches a sequence of 1 or more
                    125: matches of the regular expression.
                    126: A regular expression followed by a ? (question mark) matches a sequence of
                    127: 0 or 1 matches of the regular expression.
                    128: .IP
                    129: Two regular expressions concatenated match a match of the first followed
                    130: by a match of the second.
                    131: .IP
                    132: Two regular expressions separated by | or newline
                    133: match either a match for the first or a match for the second.
                    134: .IP
                    135: A regular expression enclosed in parentheses
                    136: matches a match for the regular expression.
                    137: .LP
                    138: The order of precedence of operators at the same parenthesis level
                    139: is [\|] then *+? then concatenation then | and newline.
                    140: .LP
                    141: Ideally there should be only one
                    142: .I grep,
                    143: but we don't know a single algorithm that spans a wide enough
                    144: range of space-time tradeoffs.
                    145: .SH "SEE ALSO"
                    146: ex(1),
                    147: sed(1),
                    148: sh(1)
                    149: .SH DIAGNOSTICS
                    150: Exit status is 0 if any matches are found,
                    151: 1 if none, 2 for syntax errors or inaccessible files.
                    152: .SH BUGS
                    153: Lines are limited to 256 characters; longer lines are truncated.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.