p4 grep
Synopsis
Print lines in files (or revisions of files) that match a pattern.
Syntax
p4 [g-opts
] grep [ options
] -e pattern
file
[revRange
]...
options: -a -i -n -v -A
num
-Bnum
-Cnum
-l -L -T -s -F -G
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.
The following example shows you can find all occurrences of a whole word:
p4 grep -e "voodoo" //depot/main/myDir/....
Options
|
The |
|
Search all revisions within the specified range, rather than only the highest revision in the range. |
|
Perform case-insensitive pattern matching. (By default, matching is case-sensitive.) |
|
Display a matching line number after the file revision number. |
|
Display files with non-matching lines. |
|
Interpret the pattern as a fixed string. |
|
Interpret the pattern as a regular expression. |
|
Display the name of each selected file from which no output would normally have been displayed; scanning stops at the first match. |
|
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, p4 grep abandons these files and reports an error) |
|
Treat binary files as text. (By default, only files of type text are selected for pattern matching.) |
|
Display |
|
Display |
|
Display |
|
See the “Global Options” section. |
Usage Notes
Can File Arguments Use Revision Specifier? |
Can File Arguments Use Revision Range? |
Minimal Access Level Required |
---|---|---|
N/A |
N/A |
|
-
By default, p4 grep searches at most 10,000 revisions. This limit is controlled by the
dm.grep.maxrevs
configurable.