Created
May 29, 2013 09:20
-
-
Save TakashiUNUMA/5669033 to your computer and use it in GitHub Desktop.
Make a frequency distribution. USAGE: awk -f FREQ_DIST.awk [input_file]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/awk -f | |
{ | |
if(binsize <= 0) exit | |
if($1 < 0){ | |
frequency[int($1 / binsize) - 1] ++ | |
}else{ | |
frequency[int($1 / binsize)] ++ | |
} | |
} | |
END{ | |
for(i in frequency){ | |
printf("%10s %15.8f\n", i * binsize, (frequency[i]/NR)) | "sort -n" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment