Calculate the mean or average of a single column of numbers in a text file

perl -lane '$total += $F[0]; END{print $total/$.}' single-column-numbers.txt
single-column-numbers.txt is a text file with 22658 rows (numbers) in a single column. Each number can range from 0 to 134298679.533591 and the dot is for the decimals. This is done with perl because awk can't sum such high numbers.
Sample Output

By: bugmenot
2021-06-30 07:45:56

What Others Think

There are many commands that i become familiar with the help of the post as you share with me. it was really good that you have given many chances for us. Thank you so much for helping us. what is gout
zaiyamariya · 4 weeks and 1 day ago
I honestly admit that I cannot call myself a successful student and therefore very often I ask myself the question of how you can improve your learning outcomes. Once I was advised to read an article about affect your studies and it gave me a lot to understand, now it has become much easier to study. The fact is that every person is motivated, and this scattering of people's attention leads them to unsatisfactory grades. One has only to concentrate your attention and you will immediately begin to succeed.
Sheetty · 4 weeks ago
Bedside Cabinet
ulrickaka · 3 weeks and 6 days ago
Best Vacation Deals Now I discovered that many of the best vacation package websites allow you to book any combination of flight, hotel, and rental car
ulrickaka · 3 weeks and 6 days ago
Glad to see this post, I like the content of this forum. [url=]bbq cleaning services[/url]
aris · 3 weeks and 4 days ago
I was very encouraged to find this site. The reason being that this is such an informative post. Thanks for sharing! bbq cleaning service
aris · 3 weeks and 4 days ago
There are different ways to write an essay, but today the most popular is pay someone to write my paper cheap
kevinvholloman · 3 weeks and 1 day ago
You have some interesting points in this article. I would never have reviewed any of this if I hadn't come across this. Thanks!. among us
among · 2 weeks and 6 days ago
This is such a great blog. Thank you for sharing your talent with everyone. You are an inspiration. composite boards
gaby1234 · 2 weeks and 2 days ago
Such a wonderful blog. Thank you for sharing this relevant post.
OldSoul1508 · 1 week and 6 days ago
Wow.... this is enlightening. Thanks for sharing this tip, software engineers at Nottingham roofers should visit this site
_chloesmith21 · 6 days ago
Gran informacion 14 mejores dietas para bajar de peso
Charles231 · 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: