Line | |
---|
1 | .TH GREP 1
|
---|
2 | .SH NAME
|
---|
3 | grep \- search a file for lines containing a given pattern
|
---|
4 | .SH SYNOPSIS
|
---|
5 | \fBgrep\fR [\fB\-elnsv\fR] \fIpattern\fR [\fIfile\fR] ...\fR
|
---|
6 | .br
|
---|
7 | .de FL
|
---|
8 | .TP
|
---|
9 | \\fB\\$1\\fR
|
---|
10 | \\$2
|
---|
11 | ..
|
---|
12 | .de EX
|
---|
13 | .TP 20
|
---|
14 | \\fB\\$1\\fR
|
---|
15 | # \\$2
|
---|
16 | ..
|
---|
17 | .SH OPTIONS
|
---|
18 | .FL "\-e" "\fB\-e \fIpattern\fR is the same as \fIpattern\fP
|
---|
19 | .FL "\-c" "Print a count of lines matched"
|
---|
20 | .FL "\-i" "Ignore case"
|
---|
21 | .FL "\-l" "Print file names, no lines"
|
---|
22 | .FL "\-n" "Print line numbers"
|
---|
23 | .FL "\-s" "Status only, no printed output"
|
---|
24 | .FL "\-v" "Select lines that do not match"
|
---|
25 | .SH EXAMPLES
|
---|
26 | .EX "grep mouse file " "Find lines in \fIfile\fP containing \fImouse\fP"
|
---|
27 | .EX "grep [0\-9] file" "Print lines containing a digit"
|
---|
28 | .SH DESCRIPTION
|
---|
29 | .PP
|
---|
30 | .I Grep
|
---|
31 | searches one or more files (by default, \fIstdin\fR) and selects out
|
---|
32 | all the lines that match the pattern.
|
---|
33 | All the regular expressions accepted by
|
---|
34 | .I ed
|
---|
35 | and
|
---|
36 | .I mined
|
---|
37 | are allowed.
|
---|
38 | In addition, + can be used instead of \(** to mean 1 or more occurrences,
|
---|
39 | ? can be used to mean 0 or 1 occurrences, and
|
---|
40 | | can be used between two regular expressions to mean either
|
---|
41 | one of them.
|
---|
42 | Parentheses can be used for grouping.
|
---|
43 | If a match is found, exit status 0 is returned.
|
---|
44 | If no match is found, exit status 1 is returned.
|
---|
45 | If an error is detected, exit status 2 is returned.
|
---|
46 | .SH "SEE ALSO"
|
---|
47 | .BR cgrep (1),
|
---|
48 | .BR fgrep (1),
|
---|
49 | .BR sed (1),
|
---|
50 | .BR awk (9).
|
---|
Note:
See
TracBrowser
for help on using the repository browser.