How to add numbers in a column

Hi All thanks a lot for your previous replies. I need some help here. I am writing a script to test a machine for a thereshold. It is genrating the list of number that have to be added but not displaying the added value.

The script is like this

#!/bin/sh
NETCOOL_LOGS=/export/home/netcool/omnibus/log

Y=`awk '{if( $2 ~ /^05/ && $1 ~ /^08.13.2008$/) print $13}' $NETCOOL_LOGS/trap.stats` ---> this give the list of number given below
for i in $Y
do
M=`echo $i`
#echo $M
Z=`echo $M | awk 'BEGIN{total=0} {total += $1} END{print total}'`
echo $Z
done
~

#this is the list of number generated
4
4
5
5
4
18
7
29
64
6
10
10
5
4
4
4
4
5
7
28
16
4
4
11
59
4
4
5
4
5
10
4
5
4
28
16
4
4
10
5
5
59
8

thanks,
Adi

If you're trying to totalize the numbers:

#!/bin/sh

NETCOOL_LOGS=/export/home/netcool/omnibus/log

awk '$2 ~ /^05/ && $1 ~ /^08.13.2008$/ {sum+=$13}END{print sum}' $NETCOOL_LOGS/trap.stats

Regards