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:
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:
sort -srn -k1.6,1 <file>
which worked as expected with starting line "hdisk12" and ending line "hdisk1".
Now the file format changed and it looks like this:
xxx hdisk1 yyy
xxx hdisk2 yyy
xxx hdisk3 yyy
xxx hdisk4 yyy
xxx hdisk5 yyy
xxx hdisk6 yyy
xxx hdisk7 yyy
xxx hdisk7 yyy
xxx hdisk8 yyy
xxx hdisk9 yyy
xxx hdisk10 yyy
xxx hdisk11 yyy
xxx hdisk12 yyy
Some fixed-length information at the beginning of each line added. But when i changed the command like below the output was not as expected:
# sort -srn -k2.6,2 <file>
xxx hdisk9 yyy
xxx hdisk8 yyy
xxx hdisk7 yyy
xxx hdisk6 yyy
xxx hdisk5 yyy
xxx hdisk4 yyy
xxx hdisk3 yyy
xxx hdisk2 yyy
xxx hdisk12 yyy
xxx hdisk11 yyy
xxx hdisk10 yyy
xxx hdisk1 yyy
Nothing i have tried so far worked and the according to the man page i *think* it should.
I'd be indebted for any pointers. Thanks.
bakunin
________
*) problem exists between keyboard and chair