Column Sum

Hi Friends :smiley:
Please help me to modify a small script. I have a file with columns like:
xxx 200
xxx 10
yyy 150
yyy 1500
zzz 05
www 120 and so on
I have to add the column 2 for a particular column 1. I am trying the script given below, it works fine but takes a lot of time usually 1-2 hrs. Can u suggest me a more faster script as my file contains more than 15 lacs records.
for i in `cat myfile | awk '{print $1}' | sort -u`
do
echo "$i\t\c"
grep "^$i" myfile | awk '{sum +=$2} END {print sum}'
done >> outputfile
Thanks in advance.

awk '{a[$1]+=$2}END{for(k in a)print k,a[k]}' myfile | sort

Hi friend,
Thanks,the script is working superbly & takes hardly 2-3 minutes to do needful.