Oh Perl Masters. I seeketh wisdom on the following issue: I am running some ClearCase commands with a script that uses a ClearCase format option to format the output, so I don't have to do it with PERL. I'm running the command using Backticks, and appears to be ignoring the format option (i.e., gives the non-formatted output). The command is designed to list all the current checkouts within the context of the current UCM project (i.e., the branch in the current view). Here is the code:
$stream = `cleartool lsstream -s`; $output = `cleartool lsco -r -brt $stream -fmt "%En\t%u\n"`; printf("$output\n");
The first command gets the stream name which is essentially the branch name that is used in the second command. The second command lists all the checkouts on that branch and formats the output so you only see the relative file path and user name. The code works, but it lists the full output instead of the formatted output. For example, if the command is run on a branch that has two checked out files, the expected (i.e., formatted) output is:
.\EDC_Export\Test_file2.txt mkjohnson .\EDC_Export\Test_file3.txt mkjohnson
Instead I am getting the full output:
--05-08T08:02 mkjohnson checkout version ".\EDC_Export\Test_file2.tx +t" from \main\p_JOESDRUGS_DT_Int\1 (reserved) Attached activity: activity:CR0002@\PROD_DT_PVOB "CR0002" --05-08T08:31 mkjohnson checkout version ".\EDC_Export\Test_file3.tx +t" from \main\p_JOESDRUGS_DT_Int\1 (reserved) Attached activity: activity:CR0002@\PROD_DT_PVOB "CR0002"
I would assume this has something to do with escaping - I have tried several different combinations with no effect (e.g., using single quotes instead of double, not escaping the double quotes, etc.). I do know that ClearCase format options are especially cantankerous in a Windows environment, so that might have something to do with it.
I have tried using the system command instead, but that has trouble recognizing the $stream variable - it gets passed with the value of 0. Code:
$output = system("cleartool lsco -r -brt $stream -fmt \"%En\t%u\n\"");
I tried ${stream} but that did not work either. Still 0.
If I enter the actual branch name in place of $stream, it works, but the output is all strung together without end of lines. Code:
$output = system("cleartool lsco -r -brt p_JOESDRUGS_DT_Int -fmt \"%En +\t%u\n\"");
Output:
.\EDC_Export\Test_file2.txt mkjohnson.\EDC_Export\Test_file3.txt + mkjohnson0
And the end of the output has a 0, which is probably telling of my foible. Any assistance would be greatly appreciated. Thank you.
In reply to ClearCase Command text in Backticks is ignored by Deep_Plaid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |