|
|
1.1 root 1: .TH GREP 1
2: .SH NAME
3: grep \- search a file for a pattern
4: .SH SYNOPSIS
5: .B grep
6: [
7: .I option ...
8: ]
9: .I pattern
10: [
11: .I file ...
12: ]
13: .SH DESCRIPTION
14: .I Grep\^
15: searches the input
16: .I files\^
17: (standard input default)
18: for lines (with newlines excluded) that match the
19: .IR pattern ,
20: a regular expression as defined in
21: .IR regexp (6).
22: Normally, each line matching the pattern is `selected',
23: and each selected line is copied to the standard output.
24: The options are
25: .TP
26: .B -c
27: Print only a count of matching lines.
28: .PD 0
29: .TP
30: .B -h
31: Do not print file name tags (headers) with output lines.
32: .TP
33: .B -i
34: Ignore alphabetic case distinctions. The implementation
35: folds into lower case all letters in the pattern and input before
36: interpretation. Matched lines are printed in their original form.
37: .TP
38: .B -l
39: (ell) Print the names of files with selected lines; don't print the lines.
40: .TP
41: .B -L
42: Print the names of files with no selected lines;
43: the converse of
44: .BR -l .
45: .TP
46: .B -n
47: Mark each printed line with its line number counted in its file.
48: .TP
49: .B -s
50: Produce no output, but return status.
51: .TP
52: .B -v
53: Reverse: print lines that do not match the pattern.
54: .PD
55: .PP
56: Output lines are tagged by file name when there is more than one
57: input file.
58: (To force this tagging, include
59: .B /dev/null
60: as a file name argument.)
61: .PP
62: Care should be taken when
63: using the shell metacharacters
64: .B $*[^|()=\e
65: and newline
66: in
67: .IR pattern ;
68: it is safest to enclose the
69: entire expression
70: in single quotes
71: .BR \&\|' \|.\|.\|.\| ' .
72: .SH SOURCE
73: .B /sys/src/cmd/grep.c
74: .SH SEE ALSO
75: .IR ed (1),
76: .IR awk (1),
77: .IR sed (1),
78: .IR sam (1),
79: .IR regexp (6)
80: .SH DIAGNOSTICS
81: Exit status is null if any lines are selected,
82: or non-null when no lines are selected or an error occurs.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.