Need help the sum from loop

Hi all,

I have one host i need to run in loop to check the capacity from different frame and get the output to one file and sum it and convert to TB

this is Code

#!/bin/ksh
DATE=`date '+%d%m%y'`
for f in `cat /home/esx-capacity/esx-host.txt`
do
for g in `cat /home/esx-capacity/frame`
do
 symaccess -sid $g  list devinfo -ig $f |grep -i total |awk '{print $3} > /home/esx-capacity/num
done
done

echo $g - num >>  Report

esx-host.txt -test1server
frame -123,234,345

I need to get the capacity from each frame and sum all and provide the output as below
test1server - 1000 TB

#!/bin/ksh
DATE=`date '+%d%m%y'`
while read f
do
   tr ',' '\n' < /home/esx-capacity/frame | while read g
   do
      symaccess -sid $g  list devinfo -ig $f
   done | grep -i total | awk '{t+=$3} END {print f " - " t}' f=$f
done < /home/esx-capacity/esx-host.txt > /home/esx-capacity/Report

hi rdrtx1
Script executed without error but no output has come in report

What is the output from this script?

#!/bin/ksh
DATE=`date '+%d%m%y'`
while read f
do
   tr ',' '\n' < /home/esx-capacity/frame | while read g
   do
      symaccess -sid $g  list devinfo -ig $f
   done | grep -i total
done < /home/esx-capacity/esx-host.txt

I don't see any output just blank

and from this?:

#!/bin/ksh
DATE=`date '+%d%m%y'`
while read f
do
   tr ',' '\n' < /home/esx-capacity/frame | while read g
   do
      echo "$g:::$f"
      #symaccess -sid $g  list devinfo -ig $f
   done
done < /home/esx-capacity/esx-host.txt

What it the output from the symaccess command?

For symaccess below is output

symaccess -sid 222  list devinfo -ig ceetest041 |grep -i total
Total Capacity                                   9839983

This the output from multiple frame

$ cat Report |grep ceetest041
295700084       ceetest041     Total   Capacity        1053089
295700624       ceetest041     Total   Capacity        48
295700826       ceetest041     Total   Capacity        53
295700831       ceetest041     Total   Capacity        12
222     ceetest041     Total   Capacity        31073660
261     ceetest041     Total   Capacity        10357912

I need the output

ceetest041  -1053089+48+53+12+31073660+10357912 SUM=total Value
awk '{a[$2]+=$NF} ; END {for (i in a) print i " = " a}' Report

where i need to copy this code

awk '{a[$2]+=$NF} ; END {for (i in a) print i " = " a}' Report

---------- Post updated at 12:04 PM ---------- Previous update was at 11:59 AM ----------

Still it is blank only. FYI i am running this from my CYGWIN console

#!/bin/ksh
DATE=`date '+%d%m%y'`
while read f
do
   tr ',' '\n' < /home/esx-capacity/frame | while read g
   do
      echo "$g:::$f"
      symaccess -sid $g  list devinfo -ig $f 
   done |awk '{a[$2]+=$NF} ; END {for (i in a) print i " = " a}' 
done < /home/esx-capacity/esx-host.txt > /home/esx-capacity/Report

What is the output of this intermediate step?:

#!/bin/ksh
DATE=`date '+%d%m%y'`
while read f
do
   tr ',' '\n' < /home/esx-capacity/frame | while read g
   do
      #symaccess -sid $g  list devinfo -ig $f
      echo symaccess -sid $g  list devinfo -ig $f
   done
done < /home/esx-capacity/esx-host.txt

Thanks rdrtx1. I can able to mage to get the report what i need by running two different script.