Problem: I wish to perform a string search on the SCM repository but FindVersion in Workbench
is limited to only perform a search specific to a project and state. I have over 200 projects that I
need to search, how can I do this without using FindVersion because that can take hours or even
days to accomplish?
Solution: A field developed command line utility was developed to accomplish this task called
Concept: This command line utility is a perl script designed to first checkout for browse (readonly)
all trunk files across all projects and states that has packages that contains file items based on a
file mask as an input parameter. For example, if you need to scan all header and cplusplus files
belonging to Microsoft projects then you would provide "*.cpp, *.h" as a file mask parameter and
the script will only checkout those files with these extensions.
Requirements:o The HarFindString.pl perl script has been tested using perl -version v5.10.1.
o Requires SqlPlus - uses Oracle TNSName and Harvest schema owner credentials.
o Install the FindFiles utility from the below attachments.
o The DOS findstr process that HarFindString.pl uses will only work with ascii text files.
o The utility deletes the checkout output when the scan process completes.
o The hco.log is the log file from the last executed hco process performed by HarFindString.pl.
The DOS findstr process that HarFindString.pl uses will only provide the path, filename, and the
single text line that matches the string search. As an alternative to this, you can download and
install the attached FindFilesInstall.zip. This windows desktop utility provides a dialog interface
GUI that allows you to enter the path to the output directory that is created by the HarFindString
perl script and the file mask and the search string. When you click the "Search" button the utility
will then perform a recursive directory search of those files in the output directory for a matching
string hit, and if a match hit occurs then it will list the file item name and path in the lower list box.
When a file item is posted in the list box, you can then double-click on the file item and it will open
in the provided CrystalEdit text editor and immediately go to the line of the matching string and
hilite it. In affect this is basically a search and display process which in my estimation is more
beneficial for any search task. The only downside for this process is that you must edit the
HarFindString.pl utility and enter an "exit 1;" line at line 252 just after the hco for loop process
and before the FINDSTR code section process. When you have editied this perl script you can
then save your change and then re-execute the HarFindString script to only perform the hco
process and leave the output directory intact so that you can use FindFiles.exe to search the
output directory. Of course after you are finished with the scanning, you can then delete the
Example script change for line 252 that will launch FindFiles.exe after the hco checkout:
$cmd="c:\\findfiles\\findfiles basepath=c:\\harfindstring\\output; filemask=*.cpp, *.h;
findtext="findstringtest"; subdirs=y; execnow=y";
$rc = system($cmd);
Here is an example screenshot of executing the HarFindString perl script in action:
Here is a example screenshot of FindFiles.exe in action searching a different path (FindFiles utility
does not have to be used exclusively for the HarFindString):
Double click on the high lighted line item will open "resource.h" in CrystalEdit (provided by FileFiles
installation) and go to and display the line with the match string and high light the string.
These utilities are provided as is, from time to time new versions may be attached to this discussion.