NAME
hsort - sort "human readable" numbers
SYNOPSIS
hsort [-r] [-s] [-f FIELD|-k FIELD] [-d DELIM] [FILE]
OPTIONS
- -f
-
sort by field FIELD instead of field 1 (the first in a line)
- -k
-
sort by field FIELD instead of field 1 (the first in a line), this options takes precedence if both (-f and -k) are given.
- -d
-
use delimiter DELIM instead of white space, perl regexps are accepted, i.e [:;] for splitting fields by colons or semicolons.
- -r
-
reverse sort, i.e. descending order
- -s
-
print sum of all values in FIELD at the end
EXAMPLES
# du -sh /home/* | hsort -r | less
The 15 biggest files in a directory:
$ ls -lh | tail +2 | \ # strip 'Total: 1234' line
hsort -k 5 | tail -n 15
NOTES
While sorting, each item is tested if it's numerical. If it's not, string comparison (cmp) is used instead of number comparison (<=>).
The summary (-s) option is ignored for non numerical fields... if the field contains both (some items numerical, some not) only the numerical fields are added.
DOWNLOAD
http://ankh-morp.org/code/misc/hsort.pl
AUTHOR
Hanno Hecker <vetinari@ankh-morp.org>




