Annotation of researchv10no/cmd/egrep/gre.1, revision 1.1.1.1

1.1       root        1: .TH GRE 1
                      2: .CT 1 files
                      3: .SH NAME
                      4: gre, grep, egrep, fgrep \(mi search a file for a pattern
                      5: .SH SYNOPSIS
                      6: .B gre
                      7: [
                      8: .I option ...
                      9: ]
                     10: .I pattern
                     11: [
                     12: .I file ...
                     13: ]
                     14: .PP
                     15: .B grep
                     16: [
                     17: .I option ...
                     18: ]
                     19: .I pattern
                     20: [
                     21: .I file ...
                     22: ]
                     23: .PP
                     24: .B egrep
                     25: [
                     26: .I option ...
                     27: ]
                     28: .I pattern
                     29: [
                     30: .I file ...
                     31: ]
                     32: .PP
                     33: .B fgrep
                     34: [
                     35: .I option ...
                     36: ]
                     37: .I strings
                     38: [
                     39: .I file ...
                     40: ]
                     41: .SH DESCRIPTION
                     42: .I Gre\^
                     43: searches the input
                     44: .I files\^
                     45: (standard input default)
                     46: for lines (with newlines excluded) that match the
                     47: .I pattern,
                     48: a regular expression as defined in
                     49: .IR re (3).
                     50: A file name of
                     51: .B -
                     52: is interpreted as standard input.
                     53: Normally, each line matching the pattern is `selected',
                     54: and each selected line is copied to the standard output.
                     55: The options are
                     56: .TP
                     57: .B -1
                     58: Print only the first selected line of each file argument.
                     59: .PD 0
                     60: .TP
                     61: .B -b
                     62: Mark each printed line with its byte position in its file.
                     63: This is sometimes useful in locating patterns in non-text files.
                     64: .TP
                     65: .B -c
                     66: Print only a count of matching lines.
                     67: .TP
                     68: .BI -e " pattern"
                     69: Same as a simple
                     70: .I pattern
                     71: argument,
                     72: but useful when
                     73: .I pattern
                     74: begins with a
                     75: .BR - .
                     76: .TP
                     77: .B -E
                     78: Simulate
                     79: .IR egrep.
                     80: .TP
                     81: .BI -f " file"
                     82: Read the pattern from
                     83: .IR file ;
                     84: there is no
                     85: .I pattern
                     86: argument
                     87: .TP
                     88: .B -F
                     89: Simulate 
                     90: .IR fgrep.
                     91: .TP
                     92: .B -G
                     93: Simulate 
                     94: .IR grep.
                     95: .TP
                     96: .B -h
                     97: Do not print filename tags (headers) with output lines.
                     98: .TP
                     99: .B -i
                    100: Ignore alphabetic case distinctions.
                    101: .TP
                    102: .B -l
                    103: Print the names of files with selected lines; don't print the lines.
                    104: .TP
                    105: .B -L
                    106: Print the names of files with no selected lines;
                    107: the converse of
                    108: .BR -l .
                    109: .TP
                    110: .B -n
                    111: Mark each printed line with its line number counted in its file.
                    112: .TP
                    113: .B -s
                    114: Produce no output, but return status.
                    115: .TP
                    116: .B -v
                    117: Reverse: print lines that do not match the pattern.
                    118: .TP
                    119: .B -x
                    120: Exact match: The pattern is
                    121: .BI ^( pattern )$ .
                    122: The implicit parentheses count in back references.
                    123: .PD
                    124: .PP
                    125: Output lines are tagged by filename when there is more than one
                    126: input file.
                    127: (To force this tagging, include
                    128: .B /dev/null
                    129: as a filename argument.)
                    130: If the output line exceeds some internal limit,
                    131: a warning is given and a small block of text surrounding the match is printed.
                    132: .PP
                    133: Care should be taken when
                    134: using the shell metacharacters
                    135: .B $*[^|()\e
                    136: and newline
                    137: in
                    138: .IR pattern ;
                    139: it is safest to enclose the
                    140: entire expression
                    141: in single quotes
                    142: .BR \&\|\(fm \|.\|.\|.\| \(fm .
                    143: .PP
                    144: .I Gre
                    145: supplants three classic programs, which are still available:
                    146: .PP
                    147: .I Grep
                    148: handles only
                    149: .IR ed (1)-like
                    150: regular expressions.
                    151: It uses
                    152: .L \e(\|\e)
                    153: instead of
                    154: .LR (\|) .
                    155: .PP
                    156: .I Egrep
                    157: handles the same patterns as
                    158: .I gre
                    159: except for back-referencing with
                    160: .BR \e1 ,
                    161: .BR \e2 ,
                    162: \&...
                    163: .PP
                    164: .I Fgrep
                    165: handles no operators except newline (alternation).
                    166: .SH SEE ALSO
                    167: .IR re (3),
                    168: .IR awk (1),
                    169: .IR sed (1),
                    170: .IR sam (9.1),
                    171: .IR strings (1)
                    172: .SH DIAGNOSTICS
                    173: Exit status is 0 if any lines are selected,
                    174: 1 if none, 2 for syntax errors, inaccessible files
                    175: (even if matches were found).
                    176: Warnings will be given for input lines that exceed
                    177: a (generous) internal limit.
                    178: .SH BUGS
                    179: .I Grep, egrep,
                    180: and 
                    181: .I fgrep
                    182: do not support some options and print block numbers
                    183: rather than byte numbers for option
                    184: .BR -b .
                    185: .br
                    186: .I Egrep
                    187: may fail on input containing characters greater
                    188: than 0176.

unix.superglobalmegacorp.com

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