Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8931051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:01:22+00:00 2026-06-15T09:01:22+00:00

Not sure if this is possible or not, but I figured I’d ask to

  • 0

Not sure if this is possible or not, but I figured I’d ask to see if anyone knows. Is it possible to find a file containing a string in a Perforce repository? Specifically, is it possible to do so without syncing the entire repository to a local directory first? (It’s quite large – I don’t think I’d have room even if I deleted lots of stuff – that’s what the archive servers are for anyhow.)

There’s any number of tools that can search through files in a local directory (I personally use Agent Ransack, but it’s just one of many), but these will not search a remote Perforce directory, unless there’s some (preferably free) tool I’m not aware of that has this capability, or maybe some hidden feature within Perforce itself?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:01:23+00:00Added an answer on June 15, 2026 at 9:01 am

    p4 grep is your friend. From the perforce blog

    ‘p4 grep’ allows users to use simple file searches as well as regular
    expressions to search through file contents of head as well as earlier
    revisions of files stored on the server. While not every single option
    of a standard grep is supported, the most important options are
    available. Here is the syntax of the command according to ‘p4 help
    grep’:

    p4 grep [ -a -i -n -v -A after -B before -C context -l -L -t -s -F -G ] -e pattern file[revRange]...
    

    See also, the manual page.

    Update: Note that there is a limitation on the number of files that Perforce will search in a single p4 grep command. Presumably this is to help keep the load on the server down. This manifests as an error:

    Grep revision limit exceeded (over 10000).
    

    If you have sufficient perforce permissions, you can use p4 configure to increase the dm.grep.maxrevs setting from this default of 10K to something larger. e.g. to set to 1 million:

    p4 configure set dm.grep.maxrevs=1M
    

    If you do not have permission to change this, you can work around it by splitting the p4 grep up into multiple commands over the subdirectories. You may have need to split further into sub-subdirectories etc depending on your depot structure.

    For example, this command can be used at a bash shell to search each subdirectory of //depot/trunk one at a time. Makes use of the p4 dirs command to obtain the list of subdirectories from the server.

    for dir in $(p4 dirs //depot/trunk/*); do
      p4 grep -s -i -e the_search_string $dir/...
    done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure if this is possible, but figured I'd ask and see if
I'm not sure if this is even possible, but I figured I'd ask before
I'm not sure if this is feasible, but I figured I'd ask and see
I'm not sure if this is exactly possible, but figured I'd throw it out
I'm not sure if this is possible but I want to see objects created
I'm not sure if this is even possible, but I figured this was a
I'm not sure if this possible but probably is fairly simple. I've made a
I'm not sure this is even possible but I know if it is, the
I'm not sure if this is possible but I'd like to be able to
I'm not sure if this is possible but as I was looking for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.