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
87553740.0874476

0
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 · 16 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 · 16 weeks ago
Bedside Cabinet
ulrickaka · 16 weeks 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 · 16 weeks ago
Glad to see this post, I like the content of this forum. [url=https://facebook.com/BBQ-Cleaning-Newcastle-112547730871201]bbq cleaning services[/url]
aris · 15 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 · 15 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 · 15 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 · 14 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 · 14 weeks and 2 days ago
Such a wonderful blog. Thank you for sharing this relevant post. hoardingcleanuplasvegas.com/
OldSoul1508 · 13 weeks and 6 days ago
Wow.... this is enlightening. Thanks for sharing this tip, software engineers at Nottingham roofers should visit this site
_chloesmith21 · 12 weeks and 6 days ago
Gran informacion 14 mejores dietas para bajar de peso
Charles231 · 12 weeks and 3 days ago
Thanks for sharing the code that helps in calculating the mean or average of a single column of numbers in a text file as you are able to clear doubts related to it as the explanation was so helpful for us to understand it http://loosediamondcuts.com">diamonds rings for cheap
Dwyane · 11 weeks and 1 day ago
The price of gold in 2023, according to experts' forecasts, may rise to $ 2,000 per ounce, and the minimum price for this precious metal will fall at the end of 2021. That is, if you already have a happy owner of a gold bar, then you just have to wait. But if you only plan someday to invest in precious metals, then I can recommend you to do it now, so as not to pay too high price later. If you don't have much money yet, then you have the opportunity to buy gold investment coins (here https://expressdigest.com/gold-coins-is-it-worth-investing/ is more information on this). It seems to me that the most important thing in investing isn't to miss the moment. I wish you good luck and early profits!
Wewam · 10 weeks and 6 days ago
Thanks so much pertaining to giving me an update on this subject on your website. Please understand that if a completely new post becomes available or in case any improvements occur on the current submission, I would be interested in reading more and knowing how to make good using of those strategies you talk about. Thanks for your time and consideration of others by making this web site available. reliable nembutal suppliers
robinjack · 10 weeks and 5 days ago
Wow.... this is enlightening. Thanks for sharing this tip https://pluton.ltd
HafsaUsmani · 10 weeks and 4 days ago
Wow.... this is enlightening. Thanks for sharing this tip Web development services
HafsaUsmani · 10 weeks and 4 days ago
Wow.... this is enlightening. Thanks for sharing this tip Tech news
HafsaUsmani · 10 weeks and 4 days ago
This is such a great post as it help the reader to find out the mean or average of a single column by using perl. This helped me a lot like I remember when I was having difficulty in essay writing so law essay writers uk provide me with there services which resolved my issues
JakeNixon2 · 10 weeks and 2 days ago
Thanks for sharing, I found a lot of interesting information here. A really good post, very thankful and helpful MyAARPMedicare.
coble251 · 9 weeks and 4 days ago
Good to see the details regarding the commands you have shared here. This post shares the details about the commands for arthritis symptoms calculating the mean or average of a single column of numbers in a text file. Students will definitely take advantage of such sites. Keep sharing more updates here.
Alyssalauren · 7 weeks and 6 days ago
Thanks for sharing the code that helps in calculating the mean or average of a single column of numbers in a text file as you are able to clear doubts related to it as the explanation was so helpful for us to understand it diamonds rings for cheap
Dwyane · 7 weeks and 5 days ago
seo what is seo search engine optimization
seofox · 4 weeks and 4 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?

commandlinefu.com 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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: