|
|
1.1 root 1: .TH PGREP 1P "22 June 1983"
2: .UC 4
3: .SH NAME
4: pgrep \- search files in a project hierarchy for a pattern
5: .SH SYNOPSIS
6: .B pgrep
7: [\fB\-eilmnw\fR] [\fB\-f \fRmakefile] [\fB\-C \fRcommand] [\fB\-F \fRpatfile]
8: [\fB\-P \fRpdirname] [\fB\-T \fRtypexpr] [pattern [file ...]]
9: .SH DESCRIPTION
10: .I Pgrep
11: searchs through the files in a project hierarchy for lines matching
12: .I pattern.
13: Normally, each line found is printed to standard output. Alternatively,
14: a
15: .I command
16: can be executed in each project directory, with arguments that are
17: the names of files containing
18: .I pattern.
19: .PP
20: The names of files can be specified as arguments, or obtained from the `HDRS'
21: and `SRCS' macro definitions in a makefile (\fB\-m \fRoption),
22: or a combination of both. When
23: .I pgrep
24: is told to use a makefile and the
25: .B \-f
26: option is not present, the files `makefile' and `Makefile' are tried in
27: order.
28: .PP
29: .I Pgrep
30: uses
31: .I pexec
32: to execute either the
33: .I grep
34: or
35: .I egrep
36: commands over a project hierarchy.
37: .I Grep
38: patterns are limited to regular expressions in the style of \fIex\fR(1).
39: .I Egrep
40: patterns are full regular expressions.
41: Care should be taken when using the characters $ * [ | ( ) and \\ in
42: .I pattern
43: as they are also meaningful to the command shell. It is safest to enclose
44: the entire
45: .I pattern
46: in single quotes.
47: .SH OPTIONS
48: .IP \fB\-e\fR
49: Use
50: .I egrep
51: instead of
52: .I grep.
53: .IP "\fB\-f \fImakefile\fR"
54: Specify an alternative
55: .I makefile
56: file name. This option also implies the
57: .B \-m
58: option.
59: .IP \fB\-i\fR
60: Ignore case of letters when making comparisons (i.e. upper and lower case
61: are considered identical).
62: .I Grep
63: only.
64: .IP \fB\-l\fR
65: List the names of files with matching lines. The file names are printed
66: one per line.
67: .IP \fB\-m\fR
68: Obtain the names of files to search from a makefile. If no
69: .B \-f
70: option is present, the makefiles `makefile' and `Makefile' are tried in order.
71: .IP \fB\-n\fR
72: Precede each matching line by its relative line number in the file.
73: .IP \fB\-w\fR
74: Treat
75: .I pattern
76: as a word (i.e. as if surrounded by `\\<' and `\\>'; see \fIex\fR(1)\|).
77: .I Grep
78: only.
79: .IP "\fB\-C \fIcommand\fR"
80: Execute
81: .I command
82: in each project directory, with arguments that are
83: the names of files containing
84: .I pattern.
85: .IP "\fB\-F \fIpatfile\fR"
86: The regular expression is taken from
87: .I patfile.
88: .I Egrep
89: only.
90: .IP "\fB\-P \fIpdirname\fR"
91: Specify a project other than the current working project. If
92: .I pdirname
93: is a project directory, search files in that directory only.
94: .IP "\fB\-T \fItypexpr\fR"
95: Only search files in project directories corresponding to boolean type
96: label expression,
97: .I typexpr.
98: .SH EXAMPLES
99: If all the directories in a project that contain source code have been
100: labeled previously as type `src', then, to search all the source code
101: makefiles for the pattern `VERSION =', type:
102: .PP
103: pgrep \-Tsrc \'\^VERSION.*=\' Makefile
104: .PP
105: where quotes surround the pattern to prevent file name expansion in the
106: current directory.
107: .PP
108: To edit all the source code files that contain the pattern `open(' using
109: the
110: .I vi
111: editor, type:
112: .PP
113: pgrep \-m \-Cvi \-Tsrc \'open(\'
114: .PP
115: where
116: .B \-m
117: tells
118: .I pgrep
119: to get the names of the source code files from a makefile.
120: .SH FILES
121: .ta \w'makefile'u+.5i
122: makefile Default makefile.
123: .br
124: Makefile Alternative default makefile.
125: .DT
126: .SH "SEE ALSO"
127: egrep(1), ex(1), grep(1), make(1), mkmf(1P), pexec(1P), pgrep(3P), vi(1)
128: .SH DIAGNOSTICS
129: Exit status is 0 if any matches are found, 1 if none,
130: 2 for syntax errors or inaccessible files and directories.
131: .SH AUTHOR
132: Peter J. Nicklin
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.