Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (10)
    As of 2014-07-11 07:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (220 votes), past polls