shithub: bin.rc

ref: 4f4b767fae09a76152d777ca1b5372218d6e5ff9
dir: /bin/hist/

View raw version
#!/bin/awk -f
function rep(s, n,		t) {
	n = int(n / (max+1) * 60)
	while (n--)
		t = t s
	return t
}
BEGIN {
	buckets = 20
	maxval = 1000
}
{ x[int($1/(maxval/buckets))]++ }
END {
	for (i = 0; i < buckets; i++)
		if (x[i] > max) max = x[i]
	for (i = 0; i < buckets; i++)
		printf("%-10d - %s\n", x[i], rep("*", x[i]))
}