• Getting the last [x] number of labels from clearcase

    I kept wanting to do this several times in the past and never got around to doing it. Yesterday I really needed to have this functionality for a autodeploy tool I am creating. I am using PHP and want to get the last 10 labels from clearcase.

    Below is how I accomplished it.
    cleartool lstype -kind lbtype -invob vob:/vobtag -fmt ‘%Nd\t%n\n’ | sort |tail -10 | awk ‘{print $2}’

    vobtag is the vob you want to get the labels against.

    By making cleartool format the output with the date in a sortable format and separate the values with a tab you can use awk to grab the last value (the label) and output.

    Keep in mind that this solution is for Unix/Linux enironment.