Skip to content

Instantly share code, notes, and snippets.

@goyuix
Created September 19, 2012 16:56
Show Gist options
  • Save goyuix/3750767 to your computer and use it in GitHub Desktop.
Save goyuix/3750767 to your computer and use it in GitHub Desktop.
Getting around the "grep revision limit exceeded" in Perforce
# p4 dirs //depot/* returns all the top level folders
#
# % means ForEach-Object, e.g. each top level folder from p4 dirs
#
# -s is to quiet the line length > 4096 noise
# -i is to make it case insensitive
# -e is followed by the search expression
# and the last argument is the path to search
p4 dirs //depot/* | % { p4 grep -s -i -e "search expression" "$_/..." }
@daybarr
Copy link

daybarr commented Apr 18, 2013

Or in bash:

for dir in $(p4 dirs //depot/trunk/*); do
  p4 grep -s -i -e 'search expression' $dir/...
done

@anishlr
Copy link

anishlr commented May 20, 2024

This isn't exactly robust. If your top-level dir branches out into other dirs and each dir has > 10k entries, this will not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment