adding up field columns in a file



Hello,
I have a file with some columns of numeric data e.g.

5 5
5 6
5 7

I need to total them, currently im using the following method


for i in cat <filename> | awk print column2 (for example)
do
total=$i
total=èxpr $total + $i`
done

However this method is really slow on large files, could someone
recommend a quicker way?

Thanks

.



Relevant Pages

  • Re: adding up field columns in a file
    ... > I have a file with some columns of numeric data e.g. ... To add the first column, ... Shell Scripting Recipes: | My code in this post, if any, ... Prev by Date: ...
    (comp.unix.admin)
  • Re: How to make binary data portable?
    ... Martin Ambuhl wrote: ... your best bet is to write numeric data as text. ... You will find that when transporting data from one ... Prev by Date: ...
    (comp.lang.c)
  • read in Matlab
    ... All files have numeric data. ... want to store in vector all of the 100's files names and than run a ... Please help, I run agains time. ... Prev by Date: ...
    (comp.soft-sys.matlab)
  • RE: adding text to a column of exsisting data
    ... If you want to add numeric data to numeric data, ... If you want to add character data to an existing cell entry, ... Prev by Date: ...
    (microsoft.public.excel.misc)