Commit | Line | Data |
---|---|---|
d38390b9 BJ |
1 | .TH GREP UCB 2/24/79 UCB |
2 | .SH NAME | |
3 | grep \- search a file for a pattern | |
4 | .SH SYNOPSIS | |
5 | .B grep | |
6 | [ | |
7 | .B \-v | |
8 | ] [ | |
9 | .B \-b | |
10 | ] [ | |
11 | .B \-c | |
12 | ] [ | |
13 | .B \-n | |
14 | ] [ | |
15 | .B \-l | |
16 | ] [ | |
17 | .B \-i | |
18 | ] [ | |
19 | .B \-w | |
20 | ] expression [ file ] ... | |
21 | .SH DESCRIPTION | |
22 | .I Grep | |
23 | searches the input files | |
24 | (standard input default) | |
25 | for lines matching the | |
26 | regular expression. | |
27 | Normally, each line found | |
28 | is copied to the standard output. | |
29 | If the | |
30 | .B \-v | |
31 | flag is used, | |
32 | all lines but those matching | |
33 | are printed. | |
34 | If the | |
35 | .B \-c | |
36 | flag is used, | |
37 | only a count of matching lines is printed. | |
38 | If the | |
39 | .B \-l | |
40 | flag is used, | |
41 | only names of files which contain matching lines are printed. | |
42 | If the | |
43 | .B \-i | |
44 | flag is used, then case of letters is ignored in comparisons. | |
45 | If the | |
46 | .B \-w | |
47 | flag is used, then the expression is searched for as a word | |
48 | (as if surrounded by `\e<' and `\e>', | |
49 | see | |
50 | .IR ex (UCB)) | |
51 | If the | |
52 | .B \-n | |
53 | flag is used, | |
54 | each line is preceded | |
55 | its relative line number in the file. | |
56 | If the | |
57 | .B \-b | |
58 | flag is used, | |
59 | each line is preceded by the block number | |
60 | on which it was found. | |
61 | This is sometimes useful in locating | |
62 | disk block numbers by context. | |
63 | .PP | |
64 | In all cases the file name is shown if there is more than one input file. | |
65 | .PP | |
66 | For a complete description | |
67 | of the regular expressions, | |
68 | see | |
69 | .IR ex (UCB). | |
70 | Care should be taken when | |
71 | using the characters | |
72 | $ * [ ^ | ( ) and \\ in the regular | |
73 | expression as they are | |
74 | also meaningful to the Shell. | |
75 | It is generally necessary to enclose the | |
76 | entire | |
77 | .I expression | |
78 | argument in quotes. | |
79 | .SH "SEE ALSO" | |
80 | ex(UCB) | |
81 | .SH BUGS | |
82 | Lines | |
83 | are limited to 256 characters; | |
84 | longer lines are truncated. |