Shell Script compare txtfile(Need Correction)

February 3, 2010 at 20:21:15
Specs: Windows XP
I have this problem; i cant compare the variable for Precount and Postcount
Its keep reading 0.
need help
My shell script as below,

Precount=0
Postcount=0

file1=/cygdrive/c/LogA.log
file2=/cygdrive/c/rLogB.log

sed q $file1 > $Precount
sed q $file2 > $Postcount
echo $Precount
echo $Postcount
if [ $Precount==$Postcount ]; then
echo "No Files Missing"
else
echo " Missing Files"
sdiff $file1 $file2 |grep '<'>>/cygdrive/c/Logc.log
fi

thanks alot


See More: Shell Script compare txtfile(Need Correction)

Report •

#1
February 3, 2010 at 20:34:31
Ok I found the mistakes
Im new to shell scripting/programming, anyhow learning from my mistakes

file1=/cygdrive/c/LogA.log
file2=/cygdrive/c/rLogB.log

Precount=`sed q $file1`
Postcount=`sed q $file2`
echo $Precount
echo $Postcount
if [ $Precount = $Postcount ]; then
echo "No Files Missing"
else
echo " Missing Files"
sdiff $file1 $file2 |grep '<'>>/cygdrive/c/Logc.log
fi

Correct me if anything wrong in above script
Thanks


Report •

#2
February 3, 2010 at 22:19:41
i was just curious as to contents or implications of q.
(new to shell, not to mention sed/ed etc.)

Report •
Related Solutions


Ask Question