You are not logged in.
Hi everyone,
i've got a very simple data file with >300 4-5 digit numbers, one per line. It looks like this:
5576
5576
5624
5624
5464
5464
6380
6380
17364Now I'm looking for an easy way to calculate the average of the sum of those numbers.
I'd appreciate some help.
Thanks.
//
awk '{ total += $1; count++ } END { print total/count }' file
OR
awk 'BEGIN{s=0;}{s+=$1;}END{print s/NR;}' fileLast edited by demian (2011-04-21 16:50:10)
no place like /home
github
Offline
You don't even mention what programming language you intend to use.
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
That's because any language typically present on an arch box would have done. Guess I should have mentioned that.
Anyway, I found a way to do it with awk.
Why do I always find the right search phrases AFTER posting here? Sorry ![]()
Solved.
Last edited by demian (2011-04-21 16:45:05)
no place like /home
github
Offline