This should do it for you:
p4 opened -u <username> | cut -d "#" -f 1 | p4 -x - where | cut -d " " -f 3 | xargs grep <search string>
Commands with channels perform the following actions:
- Get files opened by user
- Get only the depot path for each file
- Get p4, where is the output, including the path to the local file in the third column
- Cut output to get only local file path
- Grep for your string.
Note that adding the -u option to p4 openly is a more efficient way to get files opened by a specific user than grepping the output "p4 open -a".
source share