I'm looking for a way in Korn shell to zero fill (or space fill) the output from df so that it will sort properly.
"Raw" output from df -k:
Code:
df -k
Filesystem kbytes used avail capacity Mounted on
/dev/vx/dsk/rootvol 4131866 3593302 497246 88% /
/proc 0 0 0 0% /proc
fd 0 0 0 0% /dev/fd
mnttab 0 0 0 0% /etc/mnttab
swap 19891520 144 19891376 1% /var/run
swap 19913552 22176 19891376 1% /tmp
/dev/vx/dsk/u01 112302757 30833295 80346435 28% /u01
/dev/vx/dsk/node@1 96975 4977 82301 6% /global/.devices/node@1
/dev/vx/dsk/node@2 96975 4988 82290 6% /global/.devices/node@2
/dev/vx/dsk/stkdg/s03
1047527424 60483821 925353439 7% /s03
/dev/vx/dsk/stkdg/s02
1048576000 266754165 732957997 27% /s02
/dev/vx/dsk/sandg/s01
355923968 322572197 31422792 92% /global/s01
Sorted df output (which incorrectly sorts 28% and 27% after 7%):
Code:
df -k | grep / | awk '{ print $5}' | sort -r
92%
88%
7%
6%
6%
28%
27%
1%
1%
0%
0%
0%
I would like the output to display in the following format:
Code:
92%
88%
28%
27%
7%
6%
6%
1%
1%
0%
0%
0%
Any ideas?