Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><a href="https://stackoverflow.com/questions/1037659/clearcase-find-files-having-exactly-one-specific-label-and-not-more/1037829#1037829">hlovdal's answer</a> illustrates that, in this case, you have to find more elements than you need, and then filter them (despite all the <a href="http://www.samecs.com/commands/cleartool%20commands/find/find.htm" rel="nofollow noreferrer">ClearCase find features</a>). </p> <p>Note: </p> <pre><code> cleartool find . -type f -element 'lbtype_sub(LBL_A)' -print </code></pre> <p>could give you <em>directly</em> the elements (and not the version which may not be interesting in this case). You can find the version with <code>-version</code> and a format directive as explained below.</p> <p>With the help of <strong><a href="https://publib.boulder.ibm.com/infocenter/cchelp/v7r1m0/topic/com.ibm.rational.clearcase.cc_ref.doc/topics/fmt_ccase.htm" rel="nofollow noreferrer">fmt_ccase</a></strong>, you can tailor the output to get <em>precisely</em> what your perl script will need to go on:</p> <pre><code> cleartool find . -type f -element 'lbtype_sub(LBL_A)' -exec 'cleartool describe -fmt "%En %Cl\n" \"$CLEARCASE_XPN\"' | grep -v "," </code></pre> <ul> <li><code>-fmt "%En %l\n"</code> will display the full path of the <em>element</em> (instead of the version: /a/b/myFile@@/main/myVersion) <code>=&gt; /a/b/myFile'. the '</code>\n` ensure one result per line.</li> <li><strong><code>-version</code> and <code>-fmt "%n %l\n"</code> would display the version</strong></li> <li><code>\"$CLEARCASE_XPN\"</code>: the double quotes arount the extended path of the version found ensure a file with spaces in its name will still work.</li> <li><code>grep -v ","</code>: if there is any comma, that means "more than one label"</li> <li><code>%Cl</code>: avoid displaying the <em>all</em> list of labels. Anyway, if there are more than one, you are not interested!</li> </ul> <p>So, for finding the exact <strong>version</strong>:</p> <pre><code> cleartool find . -type f -version 'lbtype_sub(LBL_A)' -exec 'cleartool describe -fmt "%n %Cl\n" \"$CLEARCASE_XPN\"' | grep -v ","|awk '{sub(/ \(.*/,"");print}' </code></pre> <p>Note:<br> The above works with unix syntax. The windows syntax would be:</p> <pre><code>cleartool find . -type f -element "lbtype(LBL_A)" -exec "cleartool describe -fmt \"%n %Cl\n\" \"%CLEARCASE_XPN%\"" | grep -v "," | gawk "{gsub(/ \(.*,"");print}" </code></pre> <p>, which would list the version of files with only one (correct) label.</p> <ul> <li><code>awk '{sub(/ \(.*/,"");print}'</code> will transform "<code>myFile@@/main/myVersion (LBL_A)</code>" into "myFile@@/main/myVersion"</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload