script to sum all numbers in a file (linux)
Posted
by Mark Roberts
on Stack Overflow
See other posts from Stack Overflow
or by Mark Roberts
Published on 2010-04-23T23:36:12Z
Indexed on
2010/04/23
23:43 UTC
Read the original article
Hit count: 194
I have a file which contains several thousand numbers, each on it's own line:
34
42
11
6
2
99
...
I'm looking to write a script which will print the sum of all numbers in the file. I've got a solution, but it's not very efficient. (It takes several minutes to run.) I'm looking for a more efficient solution. Any suggestions?
© Stack Overflow or respective owner