1

[Solved] sort on numeric part of field

view story
linux-howto

http://www.unix.com – I have ran into a heavy case of PEBCAK*) and could need some advice on what i do wrong: OS is Linux (kernel 2.6.35), sort --version reports "8.5" from 2010, shell is ksh. Originally i had a file with with the following structure: Code: hdisk1 yyy hdisk2 yyy hdisk3 yyy hdisk4 yyy hdisk5 yyy hdisk6 yyy hdisk7 yyy hdisk7 yyy hdisk8 yyy hdisk9 yyy hdisk10 yyy hdisk11 yyy hdisk12 yyy I wanted to sort the file descendingly based on the numeric part if field 1, so i used the command: Code: sort -srn -k1.6,1 <file> which worked as expected with star (HowTos)