two grep in one script doesn't work?

Hi there,
the following script doesn't work. the first part works, then the second 'grep' fails with ': not found'. However, if I take out the second part (starting with the grep command) and put in a seperate script, it works.
everyone know what's wrong here? no two 'grep' in one script, that sounds weird?

#!/bin/ksh
summary1=0
summary2=0
grep 'Execution Time' test1_12.5.txt |awk '{print $3}' |sed 's/\([0-9]*\).*/\1/' |\
while read num1
do
#echo $num1
summary1=`expr $summary1 + $num1 `
done
echo "Total Execution Time: " $summary1
grep 'Total actual I/O cost for this command' test1_12.5.txt |awk '{print $8}' |sed 's/\([0-9]*\).*/\1/' |\
while read num2
do
echo $num2
summary2=`expr $summary2 + $num2 `
done
#echo "Total actual I/O cost: " $summary2

Try an export on your summary1 var. Once you invoke done, you're probably in a separate scope. Otherwise, use

typeset -x summary1...

---------- Post updated at 17:47 ---------- Previous update was at 17:47 ----------

Try an export on your summary1 var. Once you invoke done, you're probably in a separate scope. Otherwise, use

typeset -x summary1...

Can we see we see a sample of the contents of file "test1_12.5.txt" with some lines contain the string "Execution Time" and "'Total actual I/O cost for this command".