goldenmean
goldenmean

Reputation: 18956

Perforce search in depot for files which have some keyword(s) as content

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."?

Upvotes: 2

Views: 3957

Answers (2)

goldenmean
goldenmean

Reputation: 18956

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.

Upvotes: 4

Norman Morse
Norman Morse

Reputation: 135

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

Upvotes: 0

Related Questions