How can I get all Perfoce workspaces of a specific user on a specific machine?
This command let me all workspaces of a specific user on all machines:
P4 clients -u username
Here's a cmd one-liner that does more or less the same thing as pitseeker's:
for /f "tokens=2" %x in ('p4 clients -u username') do @(echo %x & p4 client -o %x | findstr /r /c:"^Host:")
A somewhat more robust batch file that seems to fit what you're looking for is:
@echo off
set USER=%1
set HOST=%2
REM Don't forget to double your for-loop percents in batch files,
REM unlike the one-liner above...
for /f "tokens=2" %%x in ('p4 clients -u %USER%') do call :CheckClient %%x
goto :EOF
:CheckClient
p4 client -o %1 | findstr /r /c:"^Host:" | findstr /i /r /c:"%HOST%$">nul && echo %1
goto :EOF
Save that and run it with the username as the first parameter and the desired host name as the second. That is, something like showclient elady elady_pc
Not exactly what you're asking for, but it's easy and perhaps sufficient:
p4 clients -u username | cut -f2 -d' ' | xargs -n 1 p4 client -o |egrep -e '^Client|^Host'
This lists all your clients and their host-restrictions (if any). In the resulting list you can find the specific machines very easily.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With