[p4] best way to parse output of 'p4 where'?

Jamie.Echlin@barclayscapital.com Jamie.Echlin at barclayscapital.com
Thu Feb 1 06:23:50 PST 2007


You can use "where -T"... I'm sure there's another way but can't find
it.

> -----Original Message-----
> From: perforce-user-bounces at perforce.com 
> [mailto:perforce-user-bounces at perforce.com] On Behalf Of Jay Glanville
> Sent: 01 February 2007 13:51
> To: Perforce Users Mailing List
> Subject: [p4] best way to parse output of 'p4 where'?
> 
> Hello all.
> 
> I have a script that needs to determine where a directory 
> exists in the
> current workspace.  Thus, I'm using the 'p4 where' command like this:
>   p4 where //depot/path/to/important/directory/...
> Now, the output of the where command returns the following:
>   - filename in depot notation
>   - filename in workspace notation
>   - filename in local OS notation
> All separated by spaces.  For example, something like this:
>   $ p4 where //depot/...
>   //depot/... //workspace_name/... E:\directory with spaces\...
> 
> The problem I'm having is the fact that the space character is being
> used as the delimiter for the three different return values, 
> especially
> when the directories themselves can contain spaces.
> 
> I'm currently using the character sequence '/... ' as the value
> delimiter, but I'm sure that this isn't the cleanest or best solution.
> 
> What I'd REALLY like to be able to do is query p4 for just 
> the filename
> in local OS notation.  Something like 'p4 where -local //depot/...'.
> 
> What is the best way to determine where a directory exists on 
> the local
> HD within the current workspace?
> 
> Thanks
> 
> JDG
> 
> PS: I'm using Perforce 2005.2.  I don't believe that 2006.2 
> contains any
> additional parameters for the 'where' command.
> 
> 
> ---
> Jay Dickon Glanville
> 
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
> 
------------------------------------------------------------------------
For more information about Barclays Capital, please visit our web site at http://www.barcap.com.

Internet communications are not secure and therefore the Barclays Group does not accept legal responsibility for the contents of this message.  Although the Barclays Group operates anti-virus programmes, it does not accept responsibility for any damage whatsoever that is caused by viruses being passed.  Any views or opinions presented are solely those of the author and do not necessarily represent those of the Barclays Group.  Replies to this email may be monitored by the Barclays Group for operational or business reasons.
------------------------------------------------------------------------



More information about the perforce-user mailing list