Annotation of researchv10dc/man/manx/grep.1, revision 1.1.1.1

1.1       root        1: .TH GREP 1
                      2: .CT 1 files
                      3: .SH NAME
                      4: grep, egrep, fgrep \(mi search a file for a pattern
                      5: .SH SYNOPSIS
                      6: .B grep
                      7: [
                      8: .I option ...
                      9: ]
                     10: .I expression
                     11: [
                     12: .I file ...
                     13: ]
                     14: .PP
                     15: .B egrep
                     16: [
                     17: .I option ...
                     18: ]
                     19: .I expression
                     20: [
                     21: .I file ...
                     22: ]
                     23: .PP
                     24: .B fgrep
                     25: [
                     26: .I option ...
                     27: ]
                     28: .I strings
                     29: [
                     30: .I file ...
                     31: ]
                     32: .SH DESCRIPTION
                     33: Commands of the
                     34: .I grep\^
                     35: family search the input
                     36: .I files\^
                     37: (standard input default)
                     38: for lines matching
                     39: a pattern.
                     40: Normally, each line found
                     41: is copied to the standard output.
                     42: .I Grep\^
                     43: patterns are limited regular
                     44: .I expressions
                     45: in the style of
                     46: .IR ed (1);
                     47: it uses a compact non-deterministic algorithm.
                     48: .I Egrep\^
                     49: patterns are full regular
                     50: .IR expressions ;
                     51: it uses a fast deterministic algorithm.
                     52: .I Fgrep\^
                     53: patterns are fixed
                     54: .IR strings ;
                     55: it is fast and compact.
                     56: The following
                     57: .I options\^
                     58: are recognized:
                     59: .TP
                     60: .BI -f " file\^"
                     61: Read the pattern from
                     62: .IR file ;
                     63: there is no pattern argument
                     64: .IR ( egrep
                     65: and
                     66: .IR fgrep ).
                     67: .PD 0
                     68: .TP
                     69: .B -v
                     70: Reverse: print lines that do not match.
                     71: .TP
                     72: .B -i
                     73: Ignore alphabetic case distinctions.
                     74: .TP
                     75: .B -n
                     76: Mark each printed line with its line number counted in its file.
                     77: .TP
                     78: .B -x
                     79: Exact: print only lines matched in their entirety
                     80: .RI ( fgrep\^
                     81: only).
                     82: .TP
                     83: .B -c
                     84: Print only a count of matching lines.
                     85: .TP
                     86: .B -l
                     87: Print only the names of files with matching lines (once).
                     88: .TP
                     89: .B -b
                     90: Mark each printed line with its block number counted in its file.
                     91: This is sometimes useful in locating
                     92: disk block numbers by context.
                     93: A block is 1024 bytes.
                     94: .TP
                     95: .B -h
                     96: Do not print filename headers with output lines.
                     97: .TP
                     98: .B -s
                     99: Produce no output, but return status.
                    100: .TP
                    101: .BI -e " expression\^"
                    102: Same as a simple
                    103: .I expression\^
                    104: argument; useful when the
                    105: .I expression\^
                    106: begins with a
                    107: .BR - .
                    108: .PD
                    109: .PP
                    110: Output lines are tagged by filename when there is more than one
                    111: input file.
                    112: Care should be taken when
                    113: using the shell metacharacters
                    114: .B $*[^|()\e
                    115: in
                    116: .IR expression ;
                    117: it is safest to enclose the
                    118: entire
                    119: .I expression\^
                    120: in single quotes
                    121: .BR \&\|\(fm \|.\|.\|.\| \(fm .
                    122: .PP
                    123: .I Fgrep\^
                    124: searches for lines that contain any of the
                    125: .I strings,
                    126: which appear as a single argument with
                    127: embedded newlines.
                    128: .PP
                    129: .I Egrep\^
                    130: accepts regular expressions as in
                    131: .IR ed (1),
                    132: with the following changes:
                    133: .TP
                    134: 1.
                    135: There is no backreferencing
                    136: .RB ( \e(\e)\e1\e2 ...).
                    137: .PD 0
                    138: .TP
                    139: 2.
                    140: The characters
                    141: .LR ^ ,
                    142: .LR $ ,
                    143: and
                    144: .L *
                    145: are always metacharacters unless quoted or contained in brackets
                    146: .BR [\^] .
                    147: .TP
                    148: 3.
                    149: A regular expression followed by
                    150: .B +
                    151: matches one or more occurrences of the
                    152: expression.
                    153: .TP
                    154: 4.
                    155: A regular expression followed by
                    156: .B ?
                    157: matches 0 or 1 occurrence.
                    158: .TP
                    159: 5.
                    160: Two regular expressions separated by \(bv or
                    161: newline match occurrences of either.
                    162: .TP
                    163: 6.
                    164: Parentheses
                    165: .B (\|)
                    166: specify grouping.
                    167: .PD
                    168: .PP
                    169: The order of precedence of operators is
                    170: .BR [\|] ,
                    171: then
                    172: .BR \(**\|?\|+ ,
                    173: then concatenation, then \(bv and new-line.
                    174: .SH SEE ALSO
                    175: .IR ed (1),
                    176: .IR sed (1),
                    177: .IR sh (1).
                    178: .SH DIAGNOSTICS
                    179: Exit status is 0 if any matches are found,
                    180: 1 if none, 2 for syntax errors or inaccessible files
                    181: (even if matches were found).
                    182: .SH BUGS
                    183: Ideally there should be only one
                    184: .IR grep ,
                    185: but we do not know a single algorithm that spans a wide enough
                    186: range of space-time tradeoffs.
                    187: .br
                    188: Lines
                    189: are truncated at
                    190: .B BUFSIZ
                    191: characters; see
                    192: .IR setbuf (3).
                    193: Null characters behave as end-of-line in matches.
                    194: .\"    @(#)grep.1      6.2 of 9/2/83

unix.superglobalmegacorp.com

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