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"]
On Fri, May 1, 2009 at 9:39 PM, Amit Uttamchandani <atu13439_AT_csun.edu> wrote:
>
> I don't have a powerful machine so using OpenOffice was out of the
> question. I was happily using gnumeric for sometime but this bug just
> killed it for me:
>
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=526379
>
> I know this will probably be fixed but I thought there must be a
> suckless way to do spreadsheets? I basically am using a
> spreadsheet for nutritional purposes and there are no cells that cross
> reference each other, etc. So it's quite simple.
>
> Can I use a text file and awk?
>
> A typical spreadsheet entry would like this:
>
> Mon (Non-Workout)
>
> Meal 6 Carbs Protein Fats
>
> 10oz reduced fat milk 15.6 11.2 5.6
> 1 scoop whey protein 3 24 1
> 1bsp flaxseed oil 0 0 13.6
>
> Totals 18.6 35.2 20.2
>
> Thanks for any help...
>
> Amit
>
>
Received on Fri May 01 2009 - 22:00:15 UTC
This archive was generated by hypermail 2.2.0 : Fri May 01 2009 - 22:12:05 UTC