Home
Command  Home
Scalable Graphic

logo_header

Soft - is your software and documentation
Asset - is something that must be protected
Management - is what we do
Enterprise - is the capability
Computing - is the power
Services - are what we provide

A.    The find command starts with a certain set of objects, selects a subset of the objects, and then performs an action on the subset. The selected objects can be elements, branches, versions, or VOB symbolic links. The action can be to list the objects or to execute a command on each object, either conditionally or unconditionally. Typically, you start with all objects in a directory tree as seen in your view. You can also start with all objects in one or more VOBs, regardless of they are visible in a particular view. Note: The find command is similar to the UNIX find(1) command. Only a limited set of the standard find options are supported; the way that commands are invoked on selected objects (–exec and –ok options) differs from find(1).

B.    (Specify the starting object) You must specify one of the following:

-       One or more elements, using pname arguments

-       One or more VOBs, using the –all option

-       All mounted VOBs, using the –avobs option

Processing all VOB elements using –all or –avobs is an order of magnitude faster than going through its entire directory tree by specifying the VOB's root directory as a pname argument. With these options, the order in which elements are processed and/or reported is very different from directory-tree order.

C.    (pname) One or more file and/or directory elements. find starts with the elements, branches, and versions that are part of the specified file elements and the subtrees under the specified directory elements.

D.    (-avobs) By default, find starts with all the elements, branches, and versions in all the VOBs mounted on the local host. In a snapshot view, find –avobs issues a warning if all mounted VOBs have not been loaded into the view. This option depends on the MVFS and is ignored on hosts that do not support dynamic views. (You must be in a view context to use find –avobs.) If the CLEARCASE_AVOBS EV is set to a colon-separated list of VOB tags (in UNIX; in Windows, list items must be separated by semicolons), this set of VOBs is used instead.

E.    (-all) With pname arguments, modifies the meaning of each argument to specify its entire VOB, not just a single file or directory. Without any pname arguments, specifies the VOB containing the current working directory.

Note: When you use find –all only one instance of an element is reported, even if one or more VOB hard links point to the element. Either the element name or one of the VOB hard links is displayed.

F.    (-nvisible) Includes only those elements, along with their branches and versions, that are not visible (do not have a standard path name) in the view.

G.    (-visible) Includes only those elements, along with their branches and versions, that are visible (have a standard path name) in the view.

H.    (select elements using standard criteria) The following options use the specified criteria to select subsets of objects

I.      (-nam·e pattern) Selects the subset of objects whose element names match the specified file-name pattern. pattern must be a leaf name. (See the wildcards_ccase reference page.

J.     (-directory) For each directory, examines only the directory itself, not the directory or file elements, or VOB symbolic links it catalogs

K.    (-depth) Causes directory entries to be processed before the directory itself.

L.     (-nrecurse) For each directory element, selects the objects in the element itself, and in the file and directory elements within it, but does not descend into its subdirectories.

M.   (-cview) Modifies the set of objects selected by the –element, –branch, and –version queries (if any). If you did not specify –version, replaces each element and branch with the version that is currently in the view. (No substitution is performed on VOB symbolic links.)  If you did specify –version, further restricts the subset to versions that are currently in the view.

N.    (-user login-name) Selects only those objects in the subset of elements owned by user login-name.

O.    (-group group-name) Selects only those objects in the subset of elements belonging to group group-name.

P.    (-type f,d, Selects the subset of objects of a certain kind: file elements (f), directory elements (d), or VOB symbolic links (l). To include multiple kinds of objects, group the key letters into a single argument (–type fd) or use multiple options (–type f –type d).

Q.    (-follow) Traverses VOB symbolic links during the walk of the directory tree.

R.    (-kind object_selector,...) The list of object kinds must be comma-separated, with no spaces. object-selector-kind can have the following values: activity,actype,anyactivity,attype,baseline,branch,brtype checkpoint,component,dbid,delem,do,domain,dover,dver eltype,felem,folder,fver,hlink,hltype,lbtype,login,oid,pool project,replica,replicauuid,role,rptype,sibrep,slink,wko

S.    (using extended pathnames) find submits the objects it selects to the specified action using extended path names, such as foo.c@@ (element), foo.c@@/main (branch), or foo.c@@/main/5 (version).

T.     (-nxname) Removes the extended naming symbol (by default, @@) and any subsequent version ID or branch path name from the name of each selected object. Duplicate names that result from this transformation are suppressed. In effect, this option transforms extended names into standard operating system names; it also transforms names of branches or versions into names of elements.

U.    (Select elements using queries) The options in this section select a subset of objects by using the VOB query language, which is described in the query_language reference page. You can use these options in any combination. They are always applied in this order, successively refining the set of selected objects: 1) –element; 2) –branch; 3) –version. The result of applying one or more of these options is a set of objects at the finest level of granularity: all versions if you used –version; all branches if you used –branch; all elements if you used –element. If you use none of these options, the set includes elements and VOB symbolic links. There is no way to use a query to select a set of VOB symbolic links.

V.    (Specify the action) You must specify an action to be performed on the selected objects. You can specify a sequence of several actions, using two –exec options, or –exec followed by –print, and so on.

 

About *_sub query primitives

When using the ClearCase find command in what circumstances should the *_sub query primitives (attype_sub, label_sub and attr_sub) be used instead of just lbtype or attype?

When the type being queried does not apply to the "level" (-element -branch -version) being queried. For example, query for a label using -element ... labels are only on versions within elements

Or

When searching recursively through the levels for all matches. For example, query for an attribute using -element, attr_sub would recursively search element, branches AND versions of the element for that attribute.

Example:
Excluding any elements that do not have both labels, list all versions in the current VOB labeled either REL1 or REL2 but not both.

cmd-context find -all -element '{lbtype_sub(REL1) && lbtype_sub(REL2)}' ^
-version '{(lbtype(REL1) && ! lbtype(REL2)) || ^
(lbtype(REL2) && !lbtype(REL1))}' -print
\dev\testfile.txt@@\main\43
\dev\testfile.txt@@\main\68
\dev\util.c@@\main\50
\dev\util.c@@\main\58
...

- (ClearCase only) List each header file (*.h) for which some version is labeled REL2 or REL3.

cmd-context find . -name '*.h' -element 'lbtype_sub(REL2) ^
|| lbtype_sub(REL3)' -print
.\hello.h@@


Without the _sub:
cmd-context find . -version 'version(\main\LATEST) && ! lbtype(REL3)' ^
-exec 'cleartool mklabel -replace REL3 %CLEARCASE_XPN%'

 

REDIRECT OUTPUT TO A FILE:

When running a cleartool find command the text can run off the screen, but you can redirect the output to a text file. To capture the data to a file for viewing, printing or use by a script (or other program) the output can be redirected as follows:

1.     To get the STDOUT information add " > file_name.txt" to the end of the command string:

·         cleartool find . -all -print > c:\out.txt

                To get both STDOUT and STDERR information add " > file_name.txt 2>&1" to the end of the command string:

·         Windows -- cleartool find . -all -print > c:\out.txt 2>&1

·         UNIX/Linux -- cleartool find . -all -print >& /tmp/out.txt

Table of Contents

Table of Contents. 5

How do I use the cleartool find command.. 7

1.       to find all file versions. 7

a).      at (or not at) the /main/LATEST version with a specific label: 7

b).      at the /main/LATEST version and update its attribute state. 8

c).      at the /main/LATEST version and then change the comment that version has. 8

d).      not at /main/LATEST that have a particular attribute and state. 8

e).      at /main/LATEST that have a particular attribute and state. 9

f).       with a particular label that have a particular attribute and state. 9

g).      with a particular label that do not have a particular attribute and state. 9

2.       to find all versions. 9

a).      with a specified label and at this version apply another label 9

b).      with a particular attribute and state. 10

c).      with an attribute and then remove the attribute. 10

h).      with a certain extension and change the protect ( to make executable!) 10

i).       with one attribute and state but not a second attribute and state, and then create the second attribute and state. 10

j).       with a certains label and create and attribute and state at these versions. 10

k).      that have one label but not another label 10

l).       that have one label but not another label but are only have a certain file extension. 11

m).           with a certain file extension and change the ClearCase type of the file. 11

n).      at the /main/LATEST version and replace and attribute type and state. 11

o).      owned by a particular user and change the protection of those files. 11

3.       to find all elements. 11

a).      that have a labelled version with one label but no versions labelled with another. 11

b).      with a certain file extension that do not have a certain label attached. 11

c).      of a certain element type and change the element type of the file. 12

4.       to find all file elements. 12

a).      and create a trigger on the elements found. 12

b).      and create an attribute on the elements found. 12

c).      and perform mass checkouts in UNIX. 12

d).      to find all elements with any label: 12

5.       to find all objects. 13

a).      and change their ownership and group proctection. 13

6.       to find all files and directories then the lock the object with a –nuser (excluded) option.. 13

a).      and then lock a series: 13

7.       to change the protection of files. 13

a).      owned by a particular user. 13

8.       with the created_since filter.. 14

a).      to find all elements created since a certain date. 14

b).      to find all file versions created since a certain date. 14

c).      to find all directories created since a certain date. 14

d).      to see what changed between two timestamps. 15

9.       to find files on a branch.. 15

a).      with a particular branch name. 15

b).      with a particular label 15

c).      with a particular label and apply another label 15

d).      to find checkouts of a specific branch: 16

e).      to List all branches on all elements run the cleartool find command in a directory and search for branches that do NOT have a non-exististent attribute. 16

10.     to find symbolic links. 17

11.     to search the text within a file to find all instance of a particular string.. 18

12.     to find all hyperlinks in a VOB and describe them (or run checkvob against them). 19

13.     to find a particular string in a comment by searching all versions of all elements in a VOB. 19

14.     to find the value of a specific hyperlink: 20

15.     to replace label names in a ClearCase VOB.. 20

16.     to count the number of versions in a VOB.. 21

17.     to Checkout all elements in a VOB.. 21

18.     to list element versions on a branch but exclude checkedout versions. 22

19.     to find elements/versions on a specific branch in multiple VOBs: 22

20.     to find elements and versions with specific comments. 23

21.     Example optimizing the cleartool find command: 23

 

Note: Where ClearCase environmental variables are used, such as, to run a –exec command against file pathaname use %CLEARCASE_PN% for Windows and $CLEARCASE_PN.  When echoing a command into cleartool user –exec “echo… (UNIX) and –exec “cmd /c echo… (Windows).

How do I use the cleartool find command

1.  to find all file versions

a).  at (or not at) the /main/LATEST version with a specific label:

 

From the current location find all the  /main/LATEST versions of files that have the ISSUE_1.0 label attached:

 

cleartool find . -type f -version "version(/main/LATEST) && lbtype(ISSUE_1.0)" –print

 

This can be turned into list the non /main/LATEST versions of files that have the ISSUE_1.0 label by adding “!  before version

 

cleartool find . -type f -version "! version(/main/LATEST) && lbtype(ISSUE_1.0)" –print

 

b). at the /main/LATEST version and update its attribute state

 

From the current location find all the /main/LATEST version of a file and replace an existing attribute state with a new attribute state.

 

cleartool find . -type -f -version 'version(/main/LATEST)' -exec 'echo mkattr -replace CIstate \\\"Configured\\\" \"$CLEARCASE_PN\"' | cleartool

 

Note: -replace updates an attribute state that already exists run without the –replace if you want to create a new attribute state on the versions of the files you find.

c).  at the /main/LATEST version and then change the comment that version has

 

cleartool find .-type f -version "version(/main/LATEST)" -exec 'cleartool chevent -insert -c "<comment>" $CLEARCASE_XPN'

 

Note: You can use -insert -append and –replace with the chevent command.

d). not at /main/LATEST that have a particular attribute and state

 

List all versions of files except the /main/LATEST version that have a certain attribute set

 

cleartool find . -type -f -version '! version(/main/LATEST) && CIstate=="Approved"' -print

 

e).  at /main/LATEST that have a particular attribute and state

 

List all files at the /main/LATEST version that have a certain attribute set

 

cleartool find . -type -f -version 'version(/main/LATEST) && CIstate=="Approved"' –print

 

f).   with a particular label that have a particular attribute and state

 

List the file versions that have a certain label and a certain attribute and state set:

 

cleartool find . -type -f -version 'version(ISSUE_1.0) && CIstate=="Approved"' –print

 

g). with a particular label that do not have a particular attribute and state

 

cleartool find . -type -f -version 'version(ISSUE_1.0) && ! CIstate=="Approved"' -print

 

2.  to find all versions

a).  with a specified label and at this version apply another label

 

From the current location find the version of a file with the SAMECS_REL_1.0.6 label and at this version apply the SAMECS_REL_2.0.0 label:

 

cleartool find . –version "lbtype(SAMECS_REL_1.0.6)" –exec 'cleartool mklabel SAMECS_REL_2.0.0 \"$CLEARCASE_PN\"'

 

A faster version is:

 

cleartool find . –version "lbtype(SAMECS_REL_1.0.6)" –exec 'echo mklabel SAMECS_REL_2.0.0 \"$CLEARCASE_PN\"' | cleartool

 

b). with a particular attribute and state

 

List all versions that have a certain attribute and state set:

 

cleartool find . –version 'CIstate=="Under_work"' –print

c).  with an attribute and then remove the attribute

 

cleartool find . -all -element 'Restrict_approvers == "Yes"' -exec 'cleartool rmattr Restrict_approvers \"$CLEARCASE_XPN\"'

h). with a certain extension and change the protect ( to make executable!)

 

cleartool find . -name *.bat -exec 'cleartool protect -chmod 774 $CLEARCASE_PN'

i).   with one attribute and state but not a second attribute and state, and then create the second attribute and state

cleartool find . -version \{CIstate=="Approved"  && !PRCR_controlled=="ClearQuest_Controlled" && version(/main/LATEST)}\ ' -exec \'cleartool mkattr PRCR_controlled \"ClearQuest_Controlled\" \”$CLEARCASE_XPN\”\'

j).   with a certains label and create and attribute and state at these versions

 

cleartool find . -version "lbtype(BULK_CHANGE_STATE)" -exec 'echo mkattr CIstate \\\"Under_work\\\" \"$CLEARCASE_XPN\"' | cleartool

k).  that have one label but not another label

 

cleartool find . -type f -version 'lbtype(<LABEL1>) && !lbtype(FEBRUARY_2006) ' -print

l).   that have one label but not another label but are only have a certain file extension

 

cleartool find . -type f  -version 'lbtype(JANUARY_2006) && !lbtype(FEBRUARY_2006) ' -print | egrep ' (.xml|.java)'

m).        with a certain file extension and change the ClearCase type of the file

 

cleartool find . -name '*.pss' -exec 'echo chtype compressed_text_file \"$CLEARCASE_PN\"' | cleartool

 

n). at the /main/LATEST version and replace and attribute type and state

 

cleartool find . -type -f -version 'version(/main/LATEST)' -exec 'echo mkattr -replace CIstate \\\"Configured\\\" \"$CLEARCASE_PN\"' | cleartool

o).  owned by a particular user and change the protection of those files

 

cleartool find . -user gbush -type f -exec 'echo protect -chgrp ccuser \"$CLEARCASE_PN\"' | cleartool

3.  to find all elements

a).  that have a labelled version with one label but no versions labelled with another

 

cleartool find . -element 'lbtype_sub(ISSUE_0.1) && !lbtype_sub(ISSUE_0.2)' –print

b).  with a certain file extension that do not have a certain label attached

 

cleartool find . -name '*.java ' -element !lbtype_sub(UE_CARPAT_TST_04.04.001) –print

 

c).  of a certain element type and change the element type of the file

 

cleartool find . -element 'eltype(text_file)' -exec 'echo chtype -force compressed_text_file \"$CLEARCASE_PN\"' | cleartool

 

4.  to find all file elements

a).  and create a trigger on the elements found

 

cleartool find . -all -type f -exec 'echo mktrigger CIstate_chkin \"$CLEARCASE_PN\"' | cleartool

 

b).  and create an attribute on the elements found

 

cleartool find . -all -type f -exec 'echo mkattr -replace CIstate \\\"Under_work\\\" \"$CLEARCASE_PN\"' | cleartool

 

c).  and perform mass checkouts in UNIX.

 

cleartool find . -type f -exec 'cleartool co -c "Testing" "$CLEARCASE_PN"'

 

Faster:

 

cleartool find . -type f -exec 'echo co -c "Testing" "$CLEARCASE_PN"' | cleartool

 

To checking substitute co with ci

d).  to find all elements with any label:

 

Windows:
cleartool find . -type f -exec "cleartool lsvtree -a %CLEARCASE_PN%" | findstr "("

./hello.c@@/main/1 (LABEL100, LABEL99, LABEL98, LABEL97)
./foo.xml@@/main/BR1/1 (REL2)
./bar.o@@/main/1 (REL1)

UNIX/Linux:
cleartool find . -type f -exec 'cleartool lsvtree -a $CLEARCASE_PN' | grep "("

./hello.c@@/main/1 (LABEL100, LABEL99, LABEL98, LABEL97)
./foo.xml@@/main/BR1/1 (REL2)
./bar.o@@/main/1 (REL1)

5.  to find all objects

a).  and change their ownership and group proctection

 

cleartool find . –kind -all -exec 'cleartool protect -chown vobadm -chgrp samecs $CLEARCASE_XPN'

6.  to find all files and directories then the lock the object with a –nuser (excluded) option

a).   and then lock a series:

 

cleartool find .  -type fd -exec 'cleartool lock -nusers vobadm -nc $CLEARCASE_PN'

 

Note: Unlock works as well, and for windows you need a % before and after the clearcase_pn part.

7.  to change the protection of files

a).  owned by a particular user

 

Find ClearCase files owned by a user and change the protection of the files accordingly:

 

cleartool find . -user gbush -type f -exec 'echo protect -chgrp samecs \"$CLEARCASE_PN\"' | cleartool

 

Note: Substitute –chgrp with –chmod or –chown as and when required. Change –type to d for directories or leave off the –type option to change both files and directories.

8.  with the created_since filter

a).  to find all elements created since a certain date

 

List all the elements below the current directory created since a certain date.

 

cleartool find . -element "{created_since(10-Jan)} " –print

b).  to find all file versions created since a certain date

 

List all the files versions below the current directory created since a certain date,

 

cleartool find . -type f -version "created_since(01-Mar)" –print

 

Note: Add the –follow options if you want to follow any symbolic links that are present.

c).  to find all directories created since a certain date

 

List all the directories below the current directory created since a certain date.

 

cleartool find . -type d -element "{created_since(10-Jan)}" -print

d).  to see what changed between two timestamps

 

The following would give you all the version created on the 10th Jan

 

cleartool find . -version 'created_since(10-Jan) && !created_since(11-Jan)' -print

 

9.  to find files on a branch

a).  with a particular branch name

 

The following will find all the files on a branch

 

cleartool find . -type f -branch "brtype(samecs_development)" -print

b).  with a particular label

 

Find the file versions on a branch that have a particular label:

 

cleartool find . -branch "brtype(samecs_development)" -version "lbtype(DECEMBER_2006)" –print

c).  with a particular label and apply another label

 

Faster and more complex. Find files on a branch with a particular label and apply another label

 

cleartool find . -branch "brtype(samecs_development)" -version "lbtype(DECEMBER_2006)" -exec 'echo mklabel NOVEMBER_2006 \"$CLEARCASE_XPN\"' | cleartool

d).  to find checkouts of a specific branch:

Windows:
Checked out on main:

 

cleartool find . -version "brtype(main)" -print | find "CHECKEDOUT" .@@\main\CHECKEDOUT

Checked out on branch, BR3:

cleartool find . -version "brtype(BR3)" -print | find "CHECKEDOUT" .\coocoo.exe@@\main\BR3\CHECKEDOUT

UNIX and Linux:

Checked out on main:

 

cleartool find . -version "brtype(main)" -print | grep CHECKEDOUT .@@/main/CHECKEDOUT

Checked out on branch, BR3:


cleartool find . -version "brtype(BR3)" -print | grep CHECKEDOUT ./coocoo.exe@@/main/BR3/CHECKEDOUT

e).   to List all branches on all elements run the cleartool find command in a directory and search for branches that do NOT have a non-exististent attribute.

For example...

cleartool find . -branch '\!attype(dummyname)' -print
.@@/main
./A1.txt@@/main
./A1.txt@@/main/A
./A1.txt@@/main/A/B
./A1.txt@@/main/A/B/D
./A1.txt@@/main/A/C
./A1.txt@@/main/A/E
./D1@@/main
./D1/D2@@/main
./D1/aaa@@/main
./E1@@/main
./E1/D2@@/main
./E1/aaa@@/main
./lost+found@@/main
./main.c@@/main
./mergeTo.xml@@/main
./mergeTo.xml@@/main/BR1

10.      to find symbolic links


UNIX and Linux:
There are two ways this can be done.

a).        cleartool find -all -type l -exec '/usr/atria/bin/cleartool describe $CLEARCASE_PN'

Example:
% cleartool find -all -type l -exec '/usr/atria/bin/cleartool describe $CLEARCASE_PN' 
symbolic link "/vobs/french/ctlink_import" -> import
created 25-Feb-03.12:34:39 by Joe_USER (joeuser.syb@lemur)
Protection:
User : joeuser : rwx
Group: syb   : rwx
Other:          : rwx
symbolic link "/vobs/french/slink_import" -> import
created 16-Apr-03.14:02:17 by Joe_USER (joeuser.syb @lemur)
Protection:
User : joeuser : rwx
Group: syb   : rwx
Other:          : rwx

b).        cleartool find -all -type l -print

Example:
%> cleartool find -all -type l -print
/vobs/french/ctlink_import
/vobs/french/slink_import

Windows:
a).        cleartool find . -type l -exec "cleartool describe -fmt \"%n %[slink_text]Tp\n\" \"%CLEARCASE_PN%\""

Example:
Y:\VOB_A>cleartool find . -type l -exec "cleartool describe -fmt "%n %[slink_text]Tp\n\n\" \"%CLEARCASE_PN%\""
.\Directory\createsymlink.txt -->..\..\VOB_B\SymlinkFolder\createsymlink.txt

Note: In the example above, the file createsymlink.txt is located in VOB_A and a symbolic link to this file was created in the SymlinkFolder in VOB_B.

b).        cleartool find -all -type l -print

Example:
Y:\VOB_A>cleartool find -all -type l -print
Y:\VOB_A\test\paul_link.txt
Y:\VOB_A\test\eric_link.txt
Y:\VOB_A\test\john_link
Y:\VOB_A\import2@@\main\10\migration9
Y:\VOB_A\import2@@\main\9\migration8

11.      to search the text within a file to find all instance of a particular string


Windows example:

Note: Uses the Windows for command.

for /f %a in ('cleartool lsvtree -all <ELEMENT NAME>') do find "<STRING>" %a

where:

<ELEMENT NAME> = element which version tree you wish to check
<STRING> = the search string you wish to look for.

Example:

for /f %a in ('cleartool lsvtree -all test.txt') do find "hi" %a

Access denied - TEST.TXT@@\MAIN
---------- TEST.TXT@@\MAIN\0
---------- TEST.TXT@@\MAIN\1
hi
---------- TEST.TXT@@\MAIN\2
hi

12.      to find all hyperlinks in a VOB and describe them (or run checkvob against them).


cleartool find . -all -kind all -exec "cleartool describe -ahlink -all \"%CLEARCASE_XPN%\""

 

Note: If needed the 'describe -ahlink -all' can be replace by a 'checkvob -hlinks',

 

13.       to find a particular string in a comment by searching all versions of all elements in a VOB.

Note: Example syntax includes formatting for the version and the comment:


UNIX/Linux:
cleartool find -all -ver "! lbtype(<non-existing label>)" -exec 'cleartool desc -fmt  "Version: %n\tComment: %c\n\n" $CLEARCASE_XPN' | grep <the string you are looking for>

Windows:
cleartool find -all -ver "! lbtype(<non-existing label>)" -exec "cleartool desc -fmt  \"Version: %n\tComment: %c\n\n\" %CLEARCASE_XPN%" | findstr "<the string you are looking for>"

14.         to find the value of a specific hyperlink:

The following command will return a "describe" on each element that is found with the type in the find command.

cleartool find . -version "hltype(Merge)" -nxname -exec 'cleartool desc $CLEARCASE_PN' -print

From the output of this command the user will get a list of all the elements. Then the user will then need to create a script to parse this output and extract just the names.

15.          to replace label names in a ClearCase VOB


In the examples below, label type REL1 is replaced with REL2.


1) If the label type is not globally, simply use the rename command:

cleartool rename lbtype:REL1 lbtype:REL2


2) If, in fact, the label is globally defined, this command will result in the following error message:

cleartool: Error: Operation "rename" not allowed on the local instance of a global label type.
cleartool: Error: Unable to rename label type from "REL1l" to "REL2".

Thus, for globally defined label types, it is necessary to use a two step process of:

- adding REL2 to all instances of REL1
- removing the REL1 labels

Here are the steps in detail:
a) First, create the label type REL2:

cleartool mklbtype REL2

b) Find the elements that already have REL1 attached to them so that the new REL2 label can be attached:

cleartool find . -ver lbtype(REL1) -exec "cleartool mklabel REL2 %CLEARCASE_PN%"

c) Remove all instances of the REL1 label:

cleartool find . -ver lbtype(REL1) -exec "cleartool rmlabel REL1 %CLEARCASE_PN%"

d) If desired, remove the REL1 label type:

cleartool rmtype -rmall lbtype:REL1

16.      to count the number of versions in a VOB

Within the VOB, use the command

cleartool find . -exec 'cleartool lsvtree -a $CLEARCASE_PN' |wc -l".

This counts the number of versions in the VOB, including those that are checked out.

17.      to Checkout all elements in a VOB

From the root of the VOB:

On Windows:

cleartool find . -type dfl -exec "cleartool checkout %CLEARCASE_PN%"

On UNIX:

cleartool find . -type dfl -exec 'cleartool checkout $CLEARCASE_PN%'

18.      to list element versions on a branch but exclude checkedout versions

The first example lists all element versions including any CHECKEDOUT versions. The second example shows how to list all element versions, but excluding any CHECKEDOUT versions.



EXAMPLE 1:
> cleartool find . -version "brtype(bugfix)" -print
./a.c@@/main/bugfix/0
./a.c@@/main/bugfix/1
./a.c@@/main/bugfix/2
./a.c@@/main/bugfix/CHECKEDOUT
./golf.c@@/main/bugfix/0
./golf.c@@/main/bugfix/1

EXAMPLE 2
> cleartool find . -version "brtype(bugfix)" -print | grep -v CHECKEDOUT
./a.c@@/main/bugfix/0
./a.c@@/main/bugfix/1
./a.c@@/main/bugfix/2
./golf.c@@/main/bugfix/0
./golf.c@@/main/bugfix/1

19.       to find elements/versions on a specific branch in multiple VOBs:

 

Version:

cleartool find -avobs -version "brtype(branch)" –print

 

Element:

cleartool find -avobs -element "brtype(branch)" -print

20.      to find elements and versions with specific comments

I want to find all elements/versions with specific comments like “Jane changed this on 11-26”

Elements:
cleartool find -all -exec "cleartool lshistory -minor -fmt \"%n\t%c\n\" \"%CLEARCASE_XPN%\"" >c:\output.txt

**This will pipe the output to a file and you would have to grep the file for the specific comments you're looking for.

Versions:
cleartool find . -version !"lbtype(LABEL_NAME)" -exec "cleartool describe -long %CLEARCASE_PN%" >c:\output2.txt

21.      Example optimizing the cleartool find command:

The below 'ct-find' commands both return the same result set, but the first one takes *hundreds of times longer*!!!.

The second find isn't faster just because caches are loaded per the first run or anything like that. Going to a new replica and running the optimized find first still gives results in a couple seconds while even then the slower find run subsequently takes minutes still.

Cleartool find is slower when you are not scoping to the -branch level before looking for the httype criteria on every single "-version" in the element's vtree


cleartool find /vob/cc/sys/makesubsys -follow -dir -version '(hltype(Merge, <-) || hltype(Merge, -> )) && brtype(main)' -print
/vob/cc/sys/makesubsys@@/main/71
/vob/cc/sys/makesubsys@@/main/86
/vob/cc/sys/makesubsys@@/main/87
/vob/cc/sys/makesubsys@@/main/88
/vob/cc/sys/makesubsys@@/main/89
/vob/cc/sys/makesubsys@@/main/90
/vob/cc/sys/makesubsys@@/main/91
/vob/cc/sys/makesubsys@@/main/92
/vob/cc/sys/makesubsys@@/main/93
/vob/cc/sys/makesubsys@@/main/94
/vob/cc/sys/makesubsys@@/main/95
/vob/cc/sys/makesubsys@@/main/96
Tue Apr 24 11:16:28 PDT 2007

cleartool find /vob/cc/sys/makesubsys -follow -dir -branch 'brtype(main)' -version '(hltype(Merge, <-) || hltype(Merge, ->))' -print;

/vob/cc/sys/makesubsys@@/main/86
/vob/cc/sys/makesubsys@@/main/87
/vob/cc/sys/makesubsys@@/main/88
/vob/cc/sys/makesubsys@@/main/89
/vob/cc/sys/makesubsys@@/main/90
/vob/cc/sys/makesubsys@@/main/91
/vob/cc/sys/makesubsys@@/main/92
/vob/cc/sys/makesubsys@@/main/93
/vob/cc/sys/makesubsys@@/main/94
/vob/cc/sys/makesubsys@@/main/95
/vob/cc/sys/makesubsys@@/main/96
/vob/cc/sys/makesubsys@@/main/71
Tue Apr 24 11:35:42 PDT 2007