Compare two directories containing TCL templates for the CcsHandler
Goal
TCL template file for the CcsHandler are not so easy to compare because they contain IDs, counter, ... which are different for every generation process for those templates. The attached procedure checks for
identical TCs send to the CcsHandler (identical script name, observation name, observation parameters)
- identical number of TCs send to PACS
- identical sequence of TCs send to PACS (excluding TC parameters)
Procedure
Execute the attached script with the directories holding the TCL templates as argument.
./compareTCLtemplates.sh DIRECTORY_1 DIRECTORY_2
Result
For each file they will be a single line of output. Possible options are:
- FILE is only in DIRECTORY_1
- FILE is only in DIRECTORY_2
- FILE is identical
- FILE is different
Script "compareTCLtemplates.sh"
dir1=$1 dir2=$2 for file in `ls $dir1` do if [ -e $dir2/$file ] then fileList="$fileList $file" else echo $file is only in $dir1 fi done for file in `ls $dir2` do if [ ! -e $dir1/$file ] then echo $file is only in $dir2 fi done tmpfile1=/tmp/compareTCLtemplates.1 tmpfile2=/tmp/compareTCLtemplates.2 for file in $fileList do gawk '/YC00/;/YP00/;/numberOfTcs/;/^ \$tcName/' $dir1/$file > $tmpfile1 gawk '/YC00/;/YP00/;/numberOfTcs/;/^ \$tcName/' $dir2/$file > $tmpfile2 if cmp -s $tmpfile1 $tmpfile2 then echo $file is identical else echo $file is different fi rm $tmpfile1 $tmpfile2 done