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

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:

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

Herschel: PACS/EQM_IMT_Procedures/compareCcshandlerTemplates (last edited 2009-07-15 14:32:36 by localhost)