Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. 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.


Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Universal configuration monitoring and system of record for IT.
Hide

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:

Hide

News

May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!
Hide

Top Tags

Hide

Functions

Psst. Open beta.

Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:

  • » The open beta is running a copy of the database that will not carry over to the final version. Don't post anything you don't mind losing.
  • » If you wish to use your user account, you will probably need to reset your password.
Your feedback is appreciated via the form on the beta page. Thanks! -Jon & CLFU Team

Display the standard deviation of a column of numbers with awk

Terminal - Display the standard deviation of a column of numbers with awk
awk '{delta = $1 - avg; avg += delta / NR; mean2 += delta * ($1 - avg); } END { print sqrt(mean2 / NR); }'
2009-09-11 04:46:01
User: ashawley
Functions: awk delta
4
Display the standard deviation of a column of numbers with awk

This will calculate a running standard deviation in one pass and should never have the possibility for overflow that can happen with other implementations. I suppose there is a potential for underflow in the corner case where the deltas are small or the values themselves are small.

Alternatives

There are 2 alternatives - vote for the best!

Terminal - Alternatives
awk '{sum+=$1; sumsq+=$1*$1} END {print sqrt(sumsq/NR - (sum/NR)**2)}' file.dat

Know a better way?

If you can do better, submit your command here.

What others think

I was the one who commented on the alternate/older system which was failing. Not 100% on how your scheme works, but it appears to get the same result at the stuff I posted.

Good job!

--

grep -e '^#BEST' 00111260_Control.ASC | grep 'L1_INT' | cut -d ',' -f 14 | less | awk '{sum+=$1; array[NR]=$1} END {for(x=1;x<=NR;x++){sumsq+=((array[x]-(sum/NR))**2);}print sqrt(sumsq/NR)}'

0.0111318

grep -e '^#BEST' 00111260_Control.ASC | grep 'L1_INT' | cut -d ',' -f 14 | less | awk '{sum+=$1; sumsq+=$1*$1} END {print sqrt(sumsq/NR - (sum/NR)**2)}'

0.0111299

grep -e '^#BEST' 00111260_Control.ASC | grep 'L1_INT' | cut -d ',' -f 14 | less | awk '{delta = $1 - avg; avg += delta / NR; mean2 += delta * ($1 - avg); } END { print sqrt(mean2 / NR); }'

0.0111318

--

Comment by mungewell 377 weeks and 1 day ago

Thanks. And thank you for testing it on your large data set.

Comment by ashawley 377 weeks and 1 day ago

fangyanting20161025

http://mulberryoutlet.outlet-store.co.uk

http://www.louis-vuittonpascher.fr

http://www.ferragamoshoes.org.uk

http://www.polooutletstore.us.com

http://www.cheapuggsforsale.in.net

http://www.ferragamooutletstore.net

http://www.pradasunglasses.us.com

http://www.christianlouboutin-outlet.me.uk

http://www.christianlouboutinonline.us.com

http://www.louboutinpas-cher.fr

http://www.toms.us.com

http://www.coachoutletclearance.us.com

http://www.tiffanyjewelryoutlet.us

http://www.cheapuggboots.net.co

http://www.cheapuggbootsforsale.in.net

http://www.coach-onlineoutlet.us.com

http://www.toryburch.com.co

http://www.cheapnf-ljerseys.us.com

http://www.uggsonsale.in.net

http://www.uggboots-onsale.in.net

http://www.cartierwatches.us

http://www.bottega-venetaoutlet.net

http://www.uggssale.eu.com

http://www.jordan-shoes.us.com

http://www.hollisteruksale.co.uk

http://www.ralphlauren-uk.org.uk

http://www.lululemonoutlet.in.net

http://www.coachoutletclearanceonline.com.co

http://www.oakley-sunglasseswholesale.us.com

http://www.michaelkorsoutletclearanceonline.in.net

http://www.celineoutletus.com

http://www.the-northfacejacket.us.com

http://www.ralphlauren-polo.com.co

http://www.michaelkorsoutletclearancesale.us.com

http://www.canada-goose.com.co

http://www.louisvuittonhand-bags.us.org

http://www.nikeair-huarache.org.uk

http://www.michaelkorsoutletonline-sale.com.co

http://www.louisvuitton-handbags.co.uk

http://www.uggbootsuk.org.uk

http://www.mulberryhand-bags.org.uk

http://www.michaelkorsoutletclearancesale.in.net

http://www.michaelkorshandbag.in.net

http://www.niketnpascher.fr

http://www.michael-korsoutletsonline.us.com

http://www.uggboots-outlet.org.uk

http://www.louisvuitton--handbags.us.com

http://www.ferragamo.eu.com

http://www.nikeoutletstore.us

http://www.longchampbag.org.uk

http://www.michaelkorshandbagsoutlet-factory.us.com

http://www.michaelkorsoutletonlinestore.in.net

http://www.bootsugg.co.uk

http://www.truereligionoutlet-store.us.com

http://www.swarovskicrystal.us.com

http://www.louis-vuittonoutletstore.us.com

http://www.foampositeshoe.net

http://www.ysloutletonline.com

http://www.truereligionoutlet.org.uk

http://www.ralphlauren-polo.org.uk

http://www.raybansunglassesinc.us.com

http://www.uggs-outlet.de.com

http://www.cheap-uggsoutlet.in.net

http://www.truereligion-sale.in.net

http://www.montblancpenss.us.com

http://www.uggsale.me.uk

http://www.cheapreplicawatches.com.co

http://www.thomassabo.me.uk

http://www.rolex-watches.it

http://www.ugg-slippers.com.co

http://www.moncleroutletstore.us.com

http://www.outlettruereligion.in.net

http://www.michaelkorsoutletstoreonline.in.net

http://www.michaelkorshandbagson-sale.us.com

http://www.celine-outlet.us.com

http://www.airjordan4.org

http://www.coachoutlethandbags.us.com

http://www.nike-outletonline.com

http://www.uggoutlet-store.in.net

http://www.beatsbydrdre-headphones.us.com

http://www.tiffanyandco.me.uk

http://www.pradahandbags.org.uk

http://www.uggson-sale.in.net

http://www.hollisterclothing.co.uk

http://www.futbol-baratas.com

http://www.polo-ralphlauren.us.org

http://www.michaelkorsoutletsclearance.us.com

http://www.coachoutletonline-factory.us.com

http://www.outlet-uggs.in.net

http://www.truereligion-jean.us.com

http://www.cheap-snapbacks.us.com

http://www.rolexwatches.in.net

http://www.coachoutletstores.com.co

http://www.kobeshoes.us

http://www.burberrysaleoutlet.us.com

http://www.michaelkorsoutletonlinestores.us.com

http://www.louisvuitton-handbags.me.uk

http://www.hollisterclothingstore.in.net

http://www.coachoutletstore.com.co

http://www.swarovski-crystal.co.uk

http://www.coachoutletonlineclearance.com.co

http://www.uggsoutlet.ca

http://www.rolexwatches-uk.org.uk

http://www.michaelkors-outletonline.in.net

http://www.mulberrybags.me.uk

http://www.nikeairmaxshoess.co.uk

http://www.hermesbirkin.org

http://www.louis-vuittonlv.us.com

http://www.wholesaleoakley-sunglasses.us.com

http://www.longchamphandbag.co.uk

http://www.canadagoose-jackets.com.co

http://www.uggsoutletstore.in.net

http://www.cheapjordan-shoes.us.com

http://www.instylerionicstyler.com

http://www.longchamphandbags.org.uk

http://www.chromeheartssunglasses.us

http://www.cheapoakleysunglass-es.us.com

http://www.coachoutletonlinesale.us

http://www.coachoutletonlinesale.com.co

http://www.cheap-ray-bansunglasses.us.com

http://www.adidasnmd.me.uk

http://www.nikefree5.us

http://www.michaelkorsoutletonline-clearance.us.com

http://www.kobebryantshoes.in.net

http://www.uggbootssale.co.uk

http://www.michaelkorsfactoryoutletonline.in.net

http://www.salomonshoes.us.com

http://www.lacostepoloshirts.cc

http://www.fitflop.in.net

http://www.tiffanyjewellery-outlet.co.uk

http://www.toryburchoutlet-online.us.com

http://www.moncler.us.com

http://www.cartier-outlet.us.com

http://www.pumaoutletonline.com

http://www.hollister-clothingstore.net

http://www.adidasyeezyboost350.us.com

http://www.canada-goosejackets.com.co

http://www.uggs-outlet.eu.com

http://www.nba-jerseyswholesale.us.com

http://www.coachoutletclearanceonline.us.com

http://www.rolexreplicawatches.com.co

http://www.canadagoose-outlet.com.co

http://www.abercrombiefitch-hollister.es

http://www.valentinooutlet.us.com

http://www.beats-headphones.in.net

http://www.hollistershirts.me.uk

http://www.adidas-yeezyboost.us.com

http://www.christianlouboutin-shoes.org.uk

http://www.truereligionjeans.org.uk

http://www.louisvuittonoutlet-clearance.us.com

http://www.fredperrypoloshirts.com

http://www.diorsunglasses.com.co

http://www.omegawatches.me.uk

http://www.mulberry-handbagsoutlet.org.uk

http://www.michaelkorsoutlet-clearance.com.co

http://www.herveleger.us.com

http://www.louisvuittonreplica.us.com

http://www.cazal.us.com

http://www.coachhandbagsclearance.us.com

http://www.michael-korsoutletclearance.com.co

http://www.thenorthfacejackets.eu.com

http://www.cheapuggoutlet.in.net

http://www.long-champoutlet.us.com

http://www.airjordan11.net

http://www.canadagooseoutlet-store.com

http://www.ferragamoshoesoutlet.net

http://www.hollistercanada.com

http://www.michael-korsoutletonline.in.net

http://www.ralphlaurenoutlet.org.uk

http://www.jordanshoes.us.com

http://www.louisvuittonhandbags.me.uk

http://www.newbalanceshoes.in.net

http://www.uggsoutlet.me.uk

http://www.guccioutletonline.us.org

http://www.coachoutletonlinestore.com.co

http://www.outletmichaelkors.org.uk

http://www.cheapoakleysunglasseswhole-sale.us.com

http://www.reebokoutletstore.us.com

http://www.thenorth-facejackets.us.com

http://www.michaelkorsoutlet-clearance.us.org

http://www.michaelkorsbags.org.uk

http://www.fitflopssale.in.net

http://www.marc-jacobs.us.org

http://www.coachoutlet-onlinestore.com.co

http://www.giuseppe-zanotti-outlet.org

http://www.louisvuittonhandbags-outlet.us.com

http://www.longchampoutlet.us.com

http://www.longchamppliage.fr

http://www.oakleysunglasseswhole-sale.us.com

http://www.louisvuittonhandbagssale.us.com

http://www.lululemonoutlet.me.uk

http://www.truereligion.org.uk

http://www.truereligionjeansoutlets.us.com

http://www.coach-factoryoutlets.us.com

http://www.truereligionjeanssale.com

http://www.toryburchhandbags.us.com

http://www.michaelkorsfactoryoutlet.us.org

http://www.nikeairforce1.fr

http://www.uggoutlet.ca

http://www.basketballshoes.us.com

http://www.vans-shoes.cc

http://www.cheapuggbootsoutlet.in.net

http://www.swarovskicrystal.in.net

http://www.reeboktrainers.org.uk

http://www.mcm-outlet.us.com

http://www.fitflopssaleclearance.in.net

http://www.kobe9elite.us.com

http://www.nike-airmax2015.us

http://www.michaelkorsfactoryoutletstore.us.com

http://www.ralphlaurenpas-cher.fr

http://www.outletmulberry.org.uk

http://www.michaelkorsfactory-outlet.in.net

http://www.katespadehandbags.me.uk

http://www.fitflopsshoes.co.uk

http://www.lebronjames.us.com

http://www.chaussurelouboutin.fr

http://www.polo-ralphlauren.com.co

http://www.oakleysunglasses.org.uk

http://www.ralphlauren-outletuk.co.uk

http://www.thenorthface-jacket.us.com

http://www.mizunorunningshoes.us

http://www.swarovskicrystals.com.co

http://www.tory-burchoutlet.us.org

http://www.swarovski.in.net

http://www.tiffanyjewelryoutlet.in.net

http://www.coachoutletonlineclearance.us.com

http://www.long-champoutlet.in.net

http://www.cheapmlbjerseys.us.com

http://www.airforce1.us.com

http://www.nhl-jerseyswholesale.us.com

http://www.outletchristianlouboutin.us.com

http://www.louisvuittonoutlet-stores.us.com

http://www.nike-airmaxshoes.org.uk

http://www.uggboots-clearance.in.net

http://www.jordan-pascher.fr

http://www.replicawatchesfor-sale.us.com

http://www.cartier-watches.us.com

http://www.fitflopssale.us

http://www.nikestore-uk.me.uk

http://www.michaelkors-handbags.co.uk

http://www.michaelkorsclearance.in.net

http://www.ralphlaurenpolo.us.com

http://www.hermes-outlet.us.com

http://www.ralphlaurenpoloshirts.org.uk

http://www.airhuarache-nike.co.uk

http://www.linksoflondons.co.uk

http://www.nikeoutletstores.us

http://www.sac-louisvuittonpascher.fr

http://www.swarovskicrystal.me.uk

http://www.rolexoutlet.us.com

http://www.cheapuggaustralia.in.net

http://www.niketrainers.me.uk

http://www.mulberryhandbagssale.co.uk

http://www.juicycoutureoutlet.net

http://www.canadagoose-jackets.me.uk

http://www.mulberrysale.co.uk

http://www.mont-blancpens.com.co

http://www.toryburchoutletsonline.in.net

http://www.nikeairmax90.co.uk

http://www.ralphlauren-polo.in.net

http://www.michaelkorshandbags.in.net

http://www.uggbootsforwomen.in.net

http://www.pradashoes.us

http://www.louisvuitton-neverfull.us.com

http://www.lebronjamesshoes.in.net

http://www.cheapmlbjerseys.net

http://www.poloralph-laurenoutlet.us.com

http://www.tiffanyjewellery.org.uk

http://www.canadagoosejackets.us.org

http://www.longchamp-solde.fr

http://www.pradaoutlet.us

http://www.todsoutlet.us.org

http://www.michaelkorshand-bagsoutlet.us.com

http://www.cheap-jordanshoes.us.com

http://www.adidasnmdshoes.us.org

http://www.ferragamo-shoes.us.com

http://www.cheap-michaelkorshandbags.in.net

http://www.converseshoes.us.com

http://www.airmax90.us.com

http://www.oakleysun-glasses.co.uk

http://www.louisvuittonoutletlv.us.com

http://www.longchamppas-cher.fr

http://www.nikefreerun5.co.uk

http://www.tomsshoes.me.uk

http://www.thenorthfacejacket.com.co

http://www.lululemonoutletonline.us.com

http://www.airjordan13s.com

http://www.toms-shoes.us.com

http://www.ugg-outlet.me.uk

http://www.adidas-trainers.org.uk

http://www.rayban--sunglasses.me.uk

http://www.louis-vuittonhandbag.us

http://www.uggboots-outlet.me.uk

http://www.michaelkorsoutletonline-store.us.com

http://www.cheap-nikeshoes.cc

http://www.fitflopsoutletsale.com

http://www.nike-mercurial.net

http://www.outlet-louisvuitton.us.com

http://www.cheapfootballshirt.org.uk

http://www.raybanssunglassescheap.us.com

http://www.rolexwatchesforsale.me.uk

http://www.airmax90.org.uk

http://www.suprashoes.us.com

http://www.nike-airmax90.org.uk

http://www.thenorth-facejacket.us.com

http://www.pandora.eu.com

http://www.michaelkorshandbagsoutletclearance.us.com

http://www.nfljerseyswholesale.us.com

http://www.fitflopssale.me.uk

http://www.michaelkorswallet.net

http://www.uggoutletstoreshoes.in.net

http://www.adidasukstore.org.uk

http://www.oakleysunglassessoutlet.us.com

http://www.ugg-bootsclearance.in.net

http://www.iphonecase.me.uk

http://www.raybansunglass.com.au

http://www.canadagoose.eu.com

http://www.michaelkorsoutlet-factory.us.com

http://www.ralph-laurenpolo.it

http://www.rolexwatchesforsale.in.net

http://www.fitflopsshoes.in.net

http://www.raybanssun-glasses.us.com

http://www.ghdstraighteners.org.uk

http://www.michaelkorshandbagsoutlet.us.org

http://www.poloralph-lauren.us.com

http://www.canadagoosejackets.eu.com

http://www.outletmichaelkors.co.uk

http://www.handbagslongchamp.us.com

http://www.cartier.us.com

http://www.adidasoutletstore.in.net

http://www.poloralph-lauren.org.uk

http://www.mbtshoes-outlet.us.com

http://www.louis--vuittonoutlet.us.com

http://www.rolexwatchesoutlet.us.com

http://www.michae-kors-outlet.ca

http://www.calvin-klein.in.net

http://www.coachoutletclearancesale.us.com

http://www.versacesunglasses.com.co

http://www.ray-bansunglassescheap.us.com

http://www.coachoutletclearancesale.com.co

http://www.uggbootsclearancesale.in.net

http://www.tomsshoes.in.net

http://www.pololacostepascher.fr

http://www.louisvuittonsunglasses.us.com

http://www.cheapoakleysun-glasseswholesale.us.com

http://www.nike-rosherun.org.uk

http://www.hermesbelts.us

http://www.wholesale-nbajerseys.com

http://www.edhardy.us.com

http://www.louis-vuitton.us.com

http://www.cheapmichaelkorshandbag.in.net

http://www.uggoutletuk.org.uk

http://www.cheapnfljerseyss.us.com

http://www.tiffany-jewelry.com.co

http://www.maccosmetics.in.net

http://www.abercrombie-fitch-hollister.fr

http://www.coachoutletonline-store.com.co

http://www.oakleysun-glassescheap.us.com

http://www.beatsbydrdre.co.uk

http://www.uggbootsoutlet.me.uk

http://www.truereligionjeanssale.in.net

http://www.ugg-bootscheap.in.net

http://www.cheapraybansun-glasses.us.com

http://www.coachoutletstoreclearance.us.com

http://www.sunglassesrayban.org.uk

http://www.uggsbootssale.in.net

http://www.nikerosherun.me.uk

http://www.canada-gooseoutlet.com.co

http://www.clearancefitflopssale.com

http://www.air-jordanshoes.us.com

http://www.michael-korshandbagsclearance.us.com

http://www.soccerjerseys.us.com

http://www.raybansun-glassess.us.com

http://www.asicsisrael.com

http://www.katespade.org.uk

http://www.uggboot.com.co

http://www.burberryoutletstore.in.net

http://www.ralphlauren-polo.us.com

http://www.cheapsoccerjersey.net

http://www.uggcanada.ca

http://www.adidas-wings.in.net

http://www.rayban-sunglasseswholesale.us.com

http://www.coachoutletonlineshopping.us.com

http://www.michaelkors-outletclearance.com.co

http://www.raybansun-glassessale.us.com

http://www.michaelkorsfactoryoutletclearance.us.com

http://www.louisvuittonoutlet-stores.us.org

http://www.louisvuittonhandbagsoutlet.org.uk

http://www.michaelkorsoutletstoreonlineclearance.us.com

http://www.michaelkorsoutlet-store.us.com

http://www.truereligionjeans-canada.com

http://www.jeanstruereligion.in.net

http://www.toryburch-outletstore.in.net

http://www.ralphlauren-pascher.fr

http://www.nikeblazerpas-cher.fr

http://www.canadagoose-outletstore.com

http://www.nikefreerun5.org.uk

http://www.ferragamoshoes.com.co

http://www.nikeairmax90.me.uk

http://www.saclongchamp-pliage.fr

http://www.mulberry-handbags.co.uk

http://www.michaelkors-wholesale.us.com

http://www.coachoutletcanada.com.co

http://www.michaelkorsuk-outlet.org.uk

http://www.uggoutletonline.com.co

http://www.burberry-outletstore.in.net

http://www.michaelkorshandbagsonsale.in.net

http://www.salvatore-ferragamo.in.net

http://www.hermesoutletstore.us.com

http://www.timberlandboots.name

http://www.longchamphand-bags.us.com

http://www.christianlouboutinscheap.us

http://www.pandorajewelryoutlet.us.com

http://www.beatsheadphones.org.uk

http://www.watchescartier.us.com

http://www.nikerosherunshoes.org.uk

http://www.michaelkorsoutlet-uk.org.uk

http://www.monclerjacketsuk.co.uk

http://www.chromeheartsoutlet.us

http://www.truereligionjeansoutlet.co.uk

http://www.oakley-sunglasses.nom.co

http://www.michaelkorsoutlet-uk.me.uk

Comment by xiaozhengm 5 weeks and 4 days ago

Your point of view

You must be signed in to comment.