[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: blank cells in ses range
From: |
Alan Mackenzie |
Subject: |
Re: blank cells in ses range |
Date: |
Sat, 27 Nov 2004 17:32:38 +0000 |
User-agent: |
tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686)) |
rb <rb@panix.com> wrote on 26 Nov 2004 16:11:39 -0500:
> What I would like is the sum of, say, Column "E", which has rows 1 -
> 10, of which approx. half are empty.
> E
> 1 41
> 2 11
> 3
> 4 9
> 5
> 6 20
> 7
> 8
> 9 15
> 10 96
> What I would like is for E10 to be (apply '+ (ses-range E1 E9)), with
> the empty cells simply eliminated from the calculation. I can't figure
> out how to make (ses+ &rest ARGS) work with the range calculation.
> Thanks very much for any help,
Does it have to be an Emacs solution?
I would suggest you use AWK here. AWK is designed to cope with awkward
things (hence the name ;-) like missing fields, and so on. The following
script would do the right thing:
# awk '{tot += $2}; END {print tot}' foo.txt
> rb
> --
--
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").