Previous Table of Contents Index Next
Perforce 2012.1: Command Reference



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 -Anum -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.
Options
-e pattern
The patterns used by p4 grep are regular expressions comparable to those used in UNIX; their syntax is fully defined in the output of p4 help grep.
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)
-A num
Display num lines of trailing context after matching lines.
-B num
Display num lines of trailing context before matching lines.
-C num
Display num lines of output context.
Usage Notes
Can File Arguments Use
Revision Specifier?
By default, p4 grep searches at most 10000 revisions. This limit is controlled by the dm.grep.maxrevs configurable.
 


Previous Table of Contents Index Next

Perforce 2012.1: Command Reference
Copyright 1999-2012 Perforce Software.