Better if you remove que hash table:
BEGIN {
FS = "\t+"
OFS= "\t"
}
$2 ~ /[0-9]+\.?[0-9]*/ {
car += $2
pro += $3
fat += $4
}
END{
print "Totals", car, pro, fat
}
On Sat, May 2, 2009 at 8:36 AM, Amit Uttamchandani <atu13439_AT_csun.edu> wrote:
> On Sat, 2 May 2009 00:00:15 +0200
> pmarin <pacogeek_AT_gmail.com> wrote:
>
>> Do you want to calculate only the total?
>> Use hard tabs "\t" to separate columns
>>
>> My version:
>>
>> BEGIN {
>> FS = "\t+"
>> OFS= "\t"
>> }
>> $2 ~ /[0-9]+\.?[0-9]*/ {
>> total["car"] += $2
>> total["pro"] += $3
>> total["fat"] += $4
>> }
>> END{
>> print "Totals", total["car"], total["pro"], total["fat"]
>>
>
> Thanks! I think this will do the trick.
>
>
Received on Sat May 02 2009 - 10:22:15 UTC
This archive was generated by hypermail 2.2.0 : Sat May 02 2009 - 10:24:04 UTC