Annotation of 43BSDTahoe/man/man1/grep.1, revision 1.1

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