File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Linux / UNIX and the fly likes Unix scripting with Perforce commands - Need help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Unix scripting with Perforce commands - Need help" Watch "Unix scripting with Perforce commands - Need help" New topic

Unix scripting with Perforce commands - Need help

Shikhar Madhok
Ranch Hand

Joined: Dec 18, 2006
Posts: 95

We are using perforce as our version control system.
I need to write a script which will list all the files that have changed between 2 branches and I also need to provide the list of users who may have touched the file. So, I am looking for an output something like

This output can be comma separated. We would like to open this report in excel and do any analysis that may be required.
I have at my disposal a few commands provided by perforce. I have been able to make some progress using redirection but feel that it would be better if I wrote a shell script instead.

I first run the following command.

The contents of report.csv are as follows

I then use the follwoing commands to format the file

After running the above commands the contents of report.csv are something like

This is as far as I have got.

I have another command to generate the list of users who have touched a file. So what I need to do is iterate to the contents of report.csv and run the command for each file.
The command that generates the list of users is

and the output it generates is

I have formatted the above output using

and I get the following output

And that is where I have stopped.
I have the 2 commands and the formatted output from each. However I feel there should be a much cleaner way to do this using shell scripting.
Unfortunately I am not so comfortable with shell scripting. Would appreciate if anyone could provide me with any suggestion on how can I go about writing a script for this. Any links etc will be appreciated as well.

Thanks for being patient to read such a long post.
And thank you for your help.

[ July 29, 2008: Message edited by: Shikhar Madhok ]

He who asks a question is a fool for five minutes; he who does not ask a question remains a fool forever - Chinese proverb
I agree. Here's the link:
subject: Unix scripting with Perforce commands - Need help
It's not a secret anymore!