1

I am a new user to Clearcase/CCRC : I want to learn using cleartool commands in windows platform for CCRC.

I have created a snapshot view using CCRC. I want to search for a first occurence of a string in a file (in all the branches) using cleartool command.

For eg : If a func name XXXX is introduced in File Y at version 10, then i want the command which will search for the function XXXX (in file Y) from base version till the version the function is introduced and should output me as version 10.

Please help me to do this.

vijayanand1231
  • 447
  • 1
  • 7
  • 20

1 Answers1

1

Once your snapshot view is loaded, you don't need a cleartool command.

You can use a simple grep command in order to search within the files.

A cleartool find command would be useful to search for a string within the message comment of a version of a file, not for the file content itself. See those examples

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>"

For a given file, you can list all versions with fmt_ccase:

cleartool find -name "yourfile" -exec "cleartool desc -fmt \"%Ln\" \"%CLEARCASE_XPN%\" && cleartool diff -pred \"%CLEARCASE_XPN%\"|grep XXXX"

(note: on Windows, you can use grep with GoW: Gnu on Windows)

The idea is to list all versions for a given file, and for each:

  • print the version (cleartool desc -fmt "%Ln")
  • diff with the previous version and grep for XXXX
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250