############################################################################
#
# This bash script calls another program that compares the numbers in two tables from two files
# The called program calculates the differences between all numeric entries in the tables 
# and returns the maximum difference found.
#
#############################################################################

#echo $0
mpath=`echo $0 | sed 's/\(.*\)............/\1/'`

######################
# check input files
######################
if [ -f $1 ]; then

numcol=`awk '{print NF}' $1 | sort -nu | tail -n 1`
numrow=`cat $1 | wc -l`

else
echo "ERROR: compare_numbertable can't find file $1"
exit 1
fi

if [ -f $2 ]; then

numcol2=`awk '{print NF}' $2 | sort -nu | tail -n 1`
numrow2=`cat $2 | wc -l`

else
echo "ERROR: compare_numbertable can't find file $2"
exit 1
fi

if [ $numrow == "0" ]; then
numcol="0"
fi

if [ $numrow2 == "0" ]; then
numcol2="0"
fi


# echo "calling: " $1 $numrow $numcol $2 $numrow2 $numcol2
$mpath''compare_numbertable_new $1 $numrow $numcol $2 $numrow2 $numcol2 $3
