You can use an -exec
directive of the command cleartool find
in order to chain a grep
command:
# Windows syntax
cleartool find . -type f -branch 'brtype(MyBranch)' -exec "grep aSpecificString \"%CLEARCASE_PN%\""
# Unix syntax
cleartool find . -type f -branch 'brtype(MyBranch)' -exec 'grep aSpecificString "$CLEARCASE_PN"'
Note the -type f
, to limit the search to files (not directories).
Note also that you will get the same file multiple times, if there are several versions of that file in the branch MyBranch
.
To limit to one file result per branch, replace -branch
by -ele
(for 'element')
(as I illustrated in "How to find the files modified under a clearcase branch"):
# Unix syntax
cleartool find . -type f -ele 'brtype(MyBranch)' -exec 'grep aSpecificString "$CLEARCASE_PN"'