Bernhard Voelker wrote:
On 01/23/2018 06:28 PM, David T-G wrote:
% Anton Aylward wrote: % find . -xdev -type f -ls | awk '{size[int(log($7)/log(2))]++}\ % END{for (i in size) printf("%10d %3d\n", 2^i, size[i])}' | \ % sort -n
That was a nice touch, since we're playing there. I don't use -ls much since there are so crazy many fields, and I really should try the printf options I've just learned here. But ...
The nice thing about -print0 is that it gets past ugly characters. Your version will break if you have a filename with (ew) a newline embedded, right?
you don't need the file names at all, just the file size:
$ find . -xdev -type f -printf '%s\n' \ | awk '{size[int(log($1)/log(2))]++} \ END {for (i in size) printf("%10d %3d\n", 2^i, size[i])}' \ | sort -n
Nice one, Berny! -- Per Jessen, Zürich (5.5°C) http://www.hostsuisse.com/ - dedicated server rental in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org