Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 644927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:26:47+00:00 2026-05-13T21:26:47+00:00

I know one awkward solution for this taks will be : first use ct

  • 0

I know one awkward solution for this taks will be :

  • first use ct ls to get the entire version info of the file
  • and pipe the version info to a parsing script to actually get the labels of the file .

But I guess ClearCase should have a “build in” solution for this task without support from any external scripts.

Please help me if you happen to know a “build in” solution for the task.
Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:26:47+00:00Added an answer on May 13, 2026 at 9:26 pm

    fmt_ccase contains all the format-string for various ClearCase elements.

    For a version of a file, you can:

     cleartool descr -fmt "%l\n" /path/to/a/version
    

    %l
    Labels: For versions, all attached labels; the null string otherwise.
    Labels are output as a comma-separated list, enclosed in parentheses.
    A <SPACE> character follows each comma.

    Variants:

    • %Cl
      Max labels: Specify the maximum number of labels to display with the max-field-width parameter (see Specifying field width).
      If there are more labels, “...” is appended to the output.
      If no max-field-width is specified, the maximum default value is 3.
    • %Nl
      No commas: Suppress the parentheses and commas in label list output;
      separate labels with spaces only.

    So the result can be:

    Labels: (Rel3.1C, Rel3.1D, Rel3.1E)
    Labels without commas or parens: Rel3.1C Rel3.1D Rel3.1E
    

    In both case, you still need to parse the result, but at least the output can contain only the labels, as in:

    Rel3.1C Rel3.1D Rel3.1E
    

    onaclov2000 adds (from the comments):

    The only problem with this is that you are grabbing the label on the specific version of the file.
    Given that branches etc can exist, we’ll need to be able to get ALL labels on a file.
    If you use version tree graphical and select tools -> “locate” you can see ALL the labels attached to that file.
    Is there a common command in cleartool that will return the results of “locate”, or “contents”?

    The lsvtree (graphical version tree) does display the labels of all the versions of the element currently seen by the view when you click “Label Name”

    That being said, there does not seem to be a “built-in” solution and some parsing is involved:

    For instance (which is a bit shorter than the OP version but still based on a cleartool ls):

    ct ls -l addon.xml@@|grep version|gawk "{gsub(/^version.*@@\\\\/,\"\",$0) ; gsub(/ \ [.*/,\"\",$0); print $0}"
    

    (GnuWin32 syntax)

    or, only with a dynamic view:

    cd m:/myView/path/to/addon.xml@@
    # list all files, not directories: the files are the labels
    dir /B /A-D 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.