#!/usr/bin/awk -f # supply max_lines and max as variables like this: # cat /usr/share/dict/words | awk '{print length($1)}' | distribution -v max_lines=5 -v max=10 BEGIN { LIMIT=max DEFAULT_MAX_LINES=55 if (lines) { NUMBER_OF_LINES=lines } else { NUMBER_OF_LINES=55 } if (max_width) { LINE_WIDTH=max_width } else { LINE_WIDTH=100 } } { if (match($1,/^[0-9\.]+$/)){ if(!LIMIT>0 || $10) bar=bar "#" printf("%8d %8d %8.4f %s\n",line * line_height,counted[line],100*records_so_far/number_of_records, bar) line ++ } }