Hi All,
I have to compare set of files so I created a case statement with the option to give more than one file to compare. The Problem now i am facing is, if I compare the files directly, from prompt or just using the script only for a particular file then It's saying No difference, but If I try to use it with the script for more than file then It's showing some difference. I tried giving echo and other things but doesn't able find the clue.
Here is what I have written.
# Comparing only the data records alone
count=86
test='87|88|89|90|91|93'
while [ $count -lt 94 ]
do
count=`expr $count + 1`
eval "case $count in
$test)
sed '1d;$d' /appl/data/test/uit/FILE20${count}/FILE20${count}* > /appl/data/test/files/diff/FILE20${count}D;
sed '1d;$d' /appl/data/test/files/copydir/FILE00$count > /appl/data/test/files/diff/FILE20${count}M;
cmp /appl/data/test/files/diff/FILE20${count}D /appl/data/test/files/diff/FILE20${count}M > sed_diff_FILE00${count}D;
rm /appl/data/test/files/diff/FILE20${count}M;
rm /appl/data/test/files/diff/FILE20${count}D;
;;
*)
;;
esac"
done
I gave * because the file will be like FILE2087_M or FILE2087_D to represent the Monthly or daily file and I am sure only one file is available in the dir.
For the above code I am getting difference in all the file.
/appl/data/test/files/diff/FILE2087D /appl/data/test/files/diff/FILE2087M differ: char 32521, line 62
/appl/data/test/files/diff/FILE2088D /appl/data/test/files/diff/FILE2088M differ: char 3374, line 23
/appl/data/test/files/diff/FILE2089D /appl/data/test/files/diff/FILE2089M differ: char 6553, line 56
/appl/data/test/files/diff/FILE2090D /appl/data/test/files/diff/FILE2090M differ: char 29968, line 281
/appl/data/test/files/diff/FILE2091D /appl/data/test/files/diff/FILE2091M differ: char 26463, line 408
But If I run the command Like the below
sed '1d;$d' /appl/data/test/uit/FILE2087/FILE2087* > /appl/data/test/files/diff/FILE2087D
sed '1d;$d' /appl/data/test/files/copydir/FILE0087 > /appl/data/test/files/diff/FILE2087M
cmp /appl/data/test/files/diff/FILE2087D /appl/data/test/files/diff/FILE2087M
I am not getting any message that means both files are similar and there is no difference.
Help me if anybody knows/faced this issue earlier.
Thanks in Advance.