dochoex
dochoex

Reputation: 319

How to find files in ClearCase that are both checkedout and have a specific extension file

In ClearCase I can find CHECKEDOUT files (on my view ) with

cleartool lsco -me -short -cview -all | sort -r

but I want to apply a regexp to filter only those that are c++ (c,h) source codes and apply on the checkedout files. The filter is

$targettedFileFilter="\\.\(c[cxp]*\|h[h]{0,1}\|sig\)\$";

I tried these two alternatives

Alternative 1:

find . -type f -regextype  posix-awk -regex ".*$targettedFileFilter" && cleartool lsco -me -short -cview -d /vobs/rbs/hw/ru_fpga/txl/sw | sort -r

Pitfall: but it takes a long time scanning all files.

Alternative 2:

cleartool lsco -me -short -cview -all | sort -r | grep -E '*.cc' 
cleartool lsco -me -short -cview -all | sort -r | grep -E '*.h' 
....

Pitfall: too much code, and need to save all outputs

Is there a way to list checked out files and apply a filter?

Upvotes: 2

Views: 142

Answers (1)

VonC
VonC

Reputation: 1323573

Considering grep -E (--extended-regexp) is able to interpret regexp (without needing to escape its special characters), all you need to type is:

cleartool lsco -me -short -cview -all | sort -r | grep -E '\.(cc|h)' 

Pattern or wildcards are not mentioned in cleartool lsco.

As Brian Cowan comments:

cleartool lsco -me -short -cview -all | grep -E '\.(cc|h)$'  | sort -r

Upvotes: 1

Related Questions