Skip to content

Instantly share code, notes, and snippets.

@ricrogz
Created April 19, 2016 07:50
Show Gist options
  • Save ricrogz/2bc12679b7e881a457aaae216ef6d66e to your computer and use it in GitHub Desktop.
Save ricrogz/2bc12679b7e881a457aaae216ef6d66e to your computer and use it in GitHub Desktop.
Find the mean, min and max values in a column using awk
$ 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}' FILE.DAT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment