#!/usr/bin/ksh
ls -l $@ | awk '
/^-/ {
l = 5*log($5)
h = sprintf("%7d %-72s",$5,$8)
print "\x1B[7m" substr(h,1,l) "\x1B[27m" substr(h,l+1)
}
'
ls command with histogram of file sizes.
The histogram scale is logaritmic, to avoid very short bars for smaller files or very long bars for bigger files.
Why?
$@ was there to replicate for ls the arguments given to the command hls, so that you can say for example:
hls -rS /bin/*
I was using ls from Debian Linux, $5 was the size and $8 was the filename.
Now I am on Solaris (different output)... can't see any $9 in the output of ls -l.
What field is $9?