Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calculating the mean of a column 1

Status
Not open for further replies.

tini1208

Technical User
Feb 13, 2006
56
DE
hi everybody,

is there a short command, to caculate the mean of a column?

thanks,
tini
 
Hi

If you mean arithmetic mean, then is quite simple :
Code:
awk 'NF{s+=$1;c++}END{print s/c}' /input/file
For example if you want the average file size in a directory :
Code:
ls -l | awk 'NF>=5{s+=$5;c++}END{print s/c}'

Feherke.
 
hi feherke,

thanks a lot for your quick answer!!!!!!

cheers, tini
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top