doing a for loop adding up the results

Hi there

If I run a 'swap -l' on my solaris box, i get

swapfile dev swaplo blocks free
/dev/dsk/c1t0d0s1 54,65 8 67119560 65655144
/dev/dsk/c1t0d0s2 54,65 8 33119522 32655122

I wanted to run a for loop adding up the totals of each column 4 , excluding the header then divide the total by 2, so i got as far as

for n in `swap -l | grep -v swapfile | awk {'print $4'}; do

# Then i drew a blank on how exactly im going to add them all up 

done

can anybody point me in the right direction ?

Any help would be greatly appreciated

swap -l | /usr/xpg4/bin/awk '/^\//{c+=$4}END{print (c/2)}'

Thanks you very much for the reply, i prompmtly went and tried it out (i used nawk as i dont have the awk you specified)

[root] # swap -l | nawk '/^\//{c+=$4}END{print (c/2)}'
50119560

perfect , thankyou