2

I found this here but is seemed a commandline option and for some reason p4 grep did not give me results. It gave errors like "must refer to client".

So i am asking, does the P4 visual client(I have version 2012 Sep-21) have any provision to search depot files for certain content entered as keyword(s)?

This is what I did to use p4 grep command:

cd

p4 grep -i -n -e dmc ./

this gave error:

./ - file(s) not in client view.

So then tried doing switch command to change to that client/workspace(they are synonyms in Perforce):

p4 client -s MyClientName

It gave error saying:

Usage: client -s [ -f ] -t template | -S stream [ clientname ]

Then even tried further but could not use the -S -t option.

What is the command to switch a client which would resolve the error message "./ - file(s) not in client view."?

Andreas
  • 5,393
  • 9
  • 44
  • 53
goldenmean
  • 18,376
  • 54
  • 154
  • 211
  • do you also want to search file content in history? Otherwise a regular Windows search can help you. With the downside that you'll also search non depot files... – vidstige Jan 02 '13 at 14:19
  • If you paste the exact 'p4 grep' command you entered, and the exact message that you received, you might get help on the 'for some reason' part of your question... – Bryan Pendleton Jan 02 '13 at 17:01
  • @Bryan Pendleton Have updated my question to mention what errors i got in p4 grep command. Let me know if u have nay pointers to get p4 grep working. – goldenmean Jan 04 '13 at 12:50
  • Indeed, 'p4 grep' works best with file specifications given in depot syntax, not in client syntax, as you relate in your answer to your own question below. Glad you got it working! – Bryan Pendleton Jan 05 '13 at 03:36

2 Answers2

4

Well finally after lot of trials and errors (There is not much discussion about this online) I got the p4 grep command to work successfully.

cd to your

grep -i -n -F -e "class"  //depot/folder1/folder2/code/*

The key is using the Perforce folder notation //depot/...

You can use any option of the grep command mentioned in its help. One can even use regular expressions as patterns/keyword.

Well done your's truly.

goldenmean
  • 18,376
  • 54
  • 154
  • 211
0

No, p4v does not have the ability to search the content of files, you will need to use "p4 grep" to do that.

Norman Morse
  • 105
  • 1
  • 5