Show the size of files and how many of each size

Here's a neat CLI script I stumbled across (in attempting to figure out how to create a sector map of all ZFS files, as a means of controlling dd to write zeros to free space):

find . -type f -print0 | xargs -0 ls -l | awk '{ n=int(log($5)/log(2)); if (n<10) { n=10; } size[n]++ } END { for (i in size) printf("%d %d\n", 2^i, size[i]) }' | sort -n | awk 'function human(x) { x[1]/=1024; if (x[1]>=1024) { x[2]++; human(x) } } { a[1]=$1; a[2]=0; human(a); printf("%3d%s: %6d\n", a[1],substr("kMGTEPYZ",a[2]+1,1),$2) }'

Output looks like this:

	1k:		2630
	2k:		366
	4k:		3070
	8k:		1506
	16k:	724
	32k:	562
	64k:	255
	128k:	117
	256k:	78
	512k:	24
	1M:		14
	2M:		15
	4M:		6
	8M:		5
	16M:	1