p4 grep
Print lines in files (or revisions of files) that match a pattern.
Syntax
p4 [g-opts] grep [-a -i -n -s -t] [-v | -l | -L] [-F | -G] [-A num] [-B num] [-C num] -e pattern file[revRange] ...
Description
The p4 grep
command searches for lines that match a
given regular expression.
By default, p4 grep
operates on the head revision.
If the file argument specifies a revision, all files as of that revision
number are searched. If the file argument has a revision range, only
those files selected by that revision range are searched, and the highest
revision in that range is used for each file.
By default, p4 grep
searches at most 10,000
revisions. This limit is controlled by the dm.grep.maxrevs
configurable.
The following example shows you can find all occurrences of a whole word:
p4 grep -e "readme" //depot/main/myDir/...
Options
|
Search all revisions within the specified range, rather than only the highest revision in the range. |
|
Display num lines of trailing context after matching lines. |
|
Display num lines of trailing context before matching lines. |
|
Display num lines of output context. |
|
The |
|
Interpret the pattern as a fixed string. |
|
Interpret the pattern as a regular expression. |
|
Perform case-insensitive pattern matching. (By default, matching is case-sensitive.) |
|
Display the name of each selected file from which no output would normally have been displayed; scanning stops at the first match. |
|
Display a matching line number after the file revision number. |
|
Display files with non-matching lines. |
|
Display the name of each selected file from which output would have been displayed; scanning stops at the first match. |
|
Suppress error messages from files with more than 4096
characters in a single line. (By default, |
|
Treat binary files as text. (By default, only files of type text are selected for pattern matching.) |
|
See Global options. |
Usage notes
Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required |
---|---|---|
N/A |
N/A |
|