Skip to content

Instantly share code, notes, and snippets.

@doi-t
Created November 26, 2013 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doi-t/7661278 to your computer and use it in GitHub Desktop.
Save doi-t/7661278 to your computer and use it in GitHub Desktop.
awkで合計、回数、最大、最小、平均を算出する
awk 'BEGIN{ OFS="\t"; sum=0; max=0; }
NR==1 { min=$2; }
{ sum+=$2; if($2>max){max=$2}; if(min>$2){min=$2}; }
END{ print($1, sum, NR, max, min, sum/NR) }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment