AWK. Calculate mean, min and max
AWK is a general purpose programing language that is designed for processing text-based data. This unix command is very powerful and with it we can calculate the mean, min and max of a data stored in file.
data.txt:
10 20 50 100 200 500
awk command:
awk '{if(min==""){min=max=$1}; if($1>max) {max=$1}; if($1< min) {min=$1}; total+=$1; count+=1} END {print total/count, min, max}' data.txt
Result:
146.667 10 500