[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
on the behaviour of "sort"
From: |
Heinz Andernach |
Subject: |
on the behaviour of "sort" |
Date: |
Thu, 22 Feb 2001 13:19:57 -0600 |
Dear Colleagues,
with surprise I noticed that the "sort" command under Linux RedHat 7 does
not seem to have the same functionality as it used to have e.g. under SUN
solaris
or even under Linux RedHat 6.2. I noticed the problem when trying to sort the
following table
col 0 1 2 3 4 5 6 7 ...
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
9004 355 13 46 33.36 -60 07 4.1 1.2 12.84 0.34 0 30 02EW 1
FFTFFFFF 1975.497
9004 802 13 48 38.84 -60 07 19.6 0.3 11.88 0.31 0 02 02EW 1
FFTFFFFF 1975.497
9004 133 13 45 42.82 -60 07 4.4 0.3 14.01 0.37 0 30 02EW 1
FFTFFFFF 1975.497
9004 490 13 45 44.00 -60 07 6.6 0.3 14.67 0.37 0 30 02EW 1
FFTFFFFF 1975.497
9004 331 13 46 0.11 -60 07 9.1 0.4 13.78 0.40 0 01 007L 2
FFTFFFTF 1976.256
9004 331 13 46 0.04 -60 07 7.5 0.5 12.42 0.37 0 30 02EW 2
FFTFFFTF 1975.497
9004 4372 13 46 8.61 -60 07 20.2 0.5 13.67 0.40 0 30 007L 1
FFTFFFFF 1976.256
9004 1518 13 45 59.06 -60 07 27.4 0.4 12.76 0.40 0 02 007L 2
FFTFFFTF 1976.256
9004 1518 13 45 59.08 -60 07 27.2 0.3 12.21 0.37 0 02 02EW 2
FFTFFFTF 1975.497
9004 277 13 49 3.00 -60 07 56.5 1.2 13.72 0.31 0 30 02EW 1
FFTFFFFF 1975.497
9004 1722 13 46 33.78 -60 07 45.1 0.3 14.50 0.34 0 30 02EW 1
FFTFFFFF 1975.497
9004 955 13 45 8.86 -60 07 34.2 0.3 13.52 0.37 0 02 02EW 1
FFTFFFFF 1975.497
9004 3358 13 46 33.21 -60 07 52.1 0.3 14.13 0.34 0 30 02EW 1
FFTFFFFF 1975.497
9004 835 13 47 37.46 -60 08 5.5 1.2 12.67 0.34 0 30 02EW 1
FFTFFFFF 1975.497
9004 967 13 48 30.21 -60 08 12.7 0.3 12.67 0.31 0 30 02EW 1
FFTFFFFF 1975.497
9004 553 13 48 19.11 -60 08 15.8 0.5 10.89 0.34 0 02 02EW 1
FFTFFFFF 1975.497
9004 220 13 46 14.58 -60 08 1.6 0.4 14.34 0.40 0 30 007L 2
FFTFFFTF 1976.256
9004 220 13 46 14.62 -60 08 1.5 0.3 12.97 0.37 0 00 02EW 2
FFTFFFTF 1975.497
9004 2094 13 45 17.26 -60 14 29.6 0.3 13.10 0.37 0 30 02EW 1
FFTFFFFF 1975.497
9004 2156 13 45 1.91 -60 15 21.7 0.3 14.63 0.37 0 30 02EW 1
FFTFFFFF 1975.497
9004 3046 13 45 23.87 -60 35 34.3 0.3 12.84 0.37 0 02 02EW 1
FFTFFFFF 1975.497
9004 325 13 45 2.42 -60 15 10.3 1.2 13.34 0.40 0 02 007L 2
FFTFFFTF 1976.256
by columns 2, 3 and 4 (with decreasing priority). The result with sort under
linux
Redhat 6.2, issuing the command sort +2 is the following
* 9004 2094 13 45 17.26 -60 14 29.6 0.3 13.10 0.37 0 30 02EW 1
FFTFFFFF 1975.497
* 9004 2156 13 45 1.91 -60 15 21.7 0.3 14.63 0.37 0 30 02EW 1
FFTFFFFF 1975.497
* 9004 3046 13 45 23.87 -60 35 34.3 0.3 12.84 0.37 0 02 02EW 1
FFTFFFFF 1975.497
* 9004 325 13 45 2.42 -60 15 10.3 1.2 13.34 0.40 0 02 007L 2
FFTFFFTF 1976.256
9004 133 13 45 42.82 -60 07 4.4 0.3 14.01 0.37 0 30 02EW 1
FFTFFFFF 1975.497
9004 490 13 45 44.00 -60 07 6.6 0.3 14.67 0.37 0 30 02EW 1
FFTFFFFF 1975.497
9004 1518 13 45 59.06 -60 07 27.4 0.4 12.76 0.40 0 02 007L 2
FFTFFFTF 1976.256
* 9004 1518 13 45 59.08 -60 07 27.2 0.3 12.21 0.37 0 02 02EW 2
FFTFFFTF 1975.497
* 9004 955 13 45 8.86 -60 07 34.2 0.3 13.52 0.37 0 02 02EW 1
FFTFFFFF 1975.497
9004 331 13 46 0.04 -60 07 7.5 0.5 12.42 0.37 0 30 02EW 2
FFTFFFTF 1975.497
9004 331 13 46 0.11 -60 07 9.1 0.4 13.78 0.40 0 01 007L 2
FFTFFFTF 1976.256
9004 220 13 46 14.58 -60 08 1.6 0.4 14.34 0.40 0 30 007L 2
FFTFFFTF 1976.256
9004 220 13 46 14.62 -60 08 1.5 0.3 12.97 0.37 0 00 02EW 2
FFTFFFTF 1975.497
9004 3358 13 46 33.21 -60 07 52.1 0.3 14.13 0.34 0 30 02EW 1
FFTFFFFF 1975.497
9004 355 13 46 33.36 -60 07 4.1 1.2 12.84 0.34 0 30 02EW 1
FFTFFFFF 1975.497
* 9004 1722 13 46 33.78 -60 07 45.1 0.3 14.50 0.34 0 30 02EW 1
FFTFFFFF 1975.497
* 9004 4372 13 46 8.61 -60 07 20.2 0.5 13.67 0.40 0 30 007L 1
FFTFFFFF 1976.256
9004 835 13 47 37.46 -60 08 5.5 1.2 12.67 0.34 0 30 02EW 1
FFTFFFFF 1975.497
9004 553 13 48 19.11 -60 08 15.8 0.5 10.89 0.34 0 02 02EW 1
FFTFFFFF 1975.497
9004 967 13 48 30.21 -60 08 12.7 0.3 12.67 0.31 0 30 02EW 1
FFTFFFFF 1975.497
9004 802 13 48 38.84 -60 07 19.6 0.3 11.88 0.31 0 02 02EW 1
FFTFFFFF 1975.497
9004 277 13 49 3.00 -60 07 56.5 1.2 13.72 0.31 0 30 02EW 1
FFTFFFFF 1975.497
I have marked with asterisk the pairs of lines which do NOT show the
correct numeric order in column 4. Even when using the -b or -n or even the
-g
option the result does not change. However, using the sort command under
linux RedHat 6.2 the command "sort +2" gives the correct result:
9004 2156 13 45 1.91 -60 15 21.7 0.3 14.63 0.37 0 30 02EW 1
FFTFFFFF 1975.497
9004 325 13 45 2.42 -60 15 10.3 1.2 13.34 0.40 0 02 007L 2
FFTFFFTF 1976.256
9004 955 13 45 8.86 -60 07 34.2 0.3 13.52 0.37 0 02 02EW 1
FFTFFFFF 1975.497
9004 2094 13 45 17.26 -60 14 29.6 0.3 13.10 0.37 0 30 02EW 1
FFTFFFFF 1975.497
9004 3046 13 45 23.87 -60 35 34.3 0.3 12.84 0.37 0 02 02EW 1
FFTFFFFF 1975.497
9004 133 13 45 42.82 -60 07 4.4 0.3 14.01 0.37 0 30 02EW 1
FFTFFFFF 1975.497
9004 490 13 45 44.00 -60 07 6.6 0.3 14.67 0.37 0 30 02EW 1
FFTFFFFF 1975.497
9004 1518 13 45 59.06 -60 07 27.4 0.4 12.76 0.40 0 02 007L 2
FFTFFFTF 1976.256
9004 1518 13 45 59.08 -60 07 27.2 0.3 12.21 0.37 0 02 02EW 2
FFTFFFTF 1975.497
9004 331 13 46 0.04 -60 07 7.5 0.5 12.42 0.37 0 30 02EW 2
FFTFFFTF 1975.497
9004 331 13 46 0.11 -60 07 9.1 0.4 13.78 0.40 0 01 007L 2
FFTFFFTF 1976.256
9004 4372 13 46 8.61 -60 07 20.2 0.5 13.67 0.40 0 30 007L 1
FFTFFFFF 1976.256
9004 220 13 46 14.58 -60 08 1.6 0.4 14.34 0.40 0 30 007L 2
FFTFFFTF 1976.256
9004 220 13 46 14.62 -60 08 1.5 0.3 12.97 0.37 0 00 02EW 2
FFTFFFTF 1975.497
9004 3358 13 46 33.21 -60 07 52.1 0.3 14.13 0.34 0 30 02EW 1
FFTFFFFF 1975.497
9004 355 13 46 33.36 -60 07 4.1 1.2 12.84 0.34 0 30 02EW 1
FFTFFFFF 1975.497
9004 1722 13 46 33.78 -60 07 45.1 0.3 14.50 0.34 0 30 02EW 1
FFTFFFFF 1975.497
9004 835 13 47 37.46 -60 08 5.5 1.2 12.67 0.34 0 30 02EW 1
FFTFFFFF 1975.497
9004 553 13 48 19.11 -60 08 15.8 0.5 10.89 0.34 0 02 02EW 1
FFTFFFFF 1975.497
9004 967 13 48 30.21 -60 08 12.7 0.3 12.67 0.31 0 30 02EW 1
FFTFFFFF 1975.497
9004 802 13 48 38.84 -60 07 19.6 0.3 11.88 0.31 0 02 02EW 1
FFTFFFFF 1975.497
9004 277 13 49 3.00 -60 07 56.5 1.2 13.72 0.31 0 30 02EW 1
FFTFFFFF 1975.497
Another example:
the list
A2804
A2667
S 89
A3466
A 533
A 514
A3223
A2881
A2814
A 999
A 193
is sorted (in my opinion "properly") by the "old" sort command (under Redhat
6.2,
and without any options) as follows:
A 193
A 514
A 533
A 999
A2667
A2804
A2814
A2881
A3223
A3466
S 89
However, under Redhat 7 the result of a simple "sort" is the following:
A 193
A2667
A2804
A2814
A2881
A3223
A3466
A 514
A 533
A 999
S 89
Obviously the blanks between the letter and numeric part are interpreted
differently
in both versions.
For your reference, my man pages say that the "old" sort and the "new" sort are
authored both by Mike Haertel. I wonder whether there is a genuine intention
for a difference between the two versions or there is some problem with my
installation?
Many thanks for your help
Heinz Andernach
Depto. de Astronomia, Univ. Guanajuato tel: +52-4-732-9548 or 732-9607
Apartado Postal 144 FAX: +52-4-732-0253
Guanajuato, C.P. 36000, GTO, Mexico Email: address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- on the behaviour of "sort",
Heinz Andernach <=