Hi managers,
the list is great, thanks for the quick answers.
Original problem below.
Solution: Sort should know that the fields are numeric. Therfore adding "n"
does the job:
sort -t . -k 12n -k 11n <file>
Again thanks a lot. Have a nice day.
Werner Rost
-----
I am sure this is a rather trivial exercise for most of you - but not for
me;-)
DU 5.1A - I want to sort data first by the 12. field and second by the
11.field. fields are separatet by ".".
The command "sort -t . -k 12 -k 11 <file>" gives:
1.3.6.1.2.1.10.7.2.1.9.23 = 0
1.3.6.1.2.1.10.7.2.1.9.23 = 0
1.3.6.1.2.1.10.7.2.1.10.24 = 0
1.3.6.1.2.1.10.7.2.1.10.24 = 0
1.3.6.1.2.1.10.7.2.1.11.24 = 0
1.3.6.1.2.1.10.7.2.1.11.24 = 0
1.3.6.1.2.1.10.7.2.1.13.24 = 0
1.3.6.1.2.1.10.7.2.1.13.24 = 0
1.3.6.1.2.1.10.7.2.1.2.24 = 0
1.3.6.1.2.1.10.7.2.1.2.24 = 0
1.3.6.1.2.1.10.7.2.1.4.24 = 0
1.3.6.1.2.1.10.7.2.1.4.24 = 0
1.3.6.1.2.1.10.7.2.1.5.24 = 0
1.3.6.1.2.1.10.7.2.1.5.24 = 0
1.3.6.1.2.1.10.7.2.1.6.24 = 0
1.3.6.1.2.1.10.7.2.1.6.24 = 0
1.3.6.1.2.1.10.7.2.1.7.24 = 0
1.3.6.1.2.1.10.7.2.1.7.24 = 0
1.3.6.1.2.1.10.7.2.1.8.24 = 0
1.3.6.1.2.1.10.7.2.1.8.24 = 0
1.3.6.1.2.1.10.7.2.1.9.24 = 0
1.3.6.1.2.1.10.7.2.1.9.24 = 0
1.3.6.1.2.1.16.1.1.1.11.24 = 10 < not sorted by field 11
1.3.6.1.2.1.10.7.2.1.3.24 = 10 < not sorted by field 11
1.3.6.1.2.1.16.1.1.1.8.24 = 10 < not sorted by field 11
1.3.6.1.2.1.16.1.1.1.11.24 = 33 < not sorted by field 11
1.3.6.1.2.1.10.7.2.1.3.24 = 80 < not sorted by field 11
1.3.6.1.2.1.16.1.1.1.8.24 = 80 < not sorted by field 11
1.3.6.1.2.1.10.7.2.1.10.3 = 0
1.3.6.1.2.1.10.7.2.1.10.3 = 0
Unfortunatly some lines are not sorted as I expect.
Which sort command does what I want?
Thanks in advance for your help.
Yours sincerely
Werner Rost
GM-FIR - Netzwerk
ZF Boge Elastmetall GmbH
Friesdorfer Str. 175, 53175 Bonn, Deutschland/Germany Telefon/Phone +49 228
3825 - 420 Telefax/Fax +49 228 3825 - 398 werner.rost_at_zf.com
Received on Thu Dec 02 2004 - 10:50:13 NZDT