bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Coreutils Command "sort" Needs Manual Clarity


From: Tony Kocurko
Subject: Coreutils Command "sort" Needs Manual Clarity
Date: Tue, 04 Mar 2008 15:00:44 -0330
User-agent: Thunderbird 2.0.0.12 (X11/20080227)

Hi, All...

 It might be that the man page for sort needs some
polishing. I discovered that in the "-k F[.C],F[.C]"
command line argument pair, for fields beyond the
first, the first character appears to be the first
delimiter character prior to the field. For example,

# cat SortProblem1
ABC 010201
DEF 010202
GHI 020203
JKL 010204
MNO 010208
PQR 010301
STU 010302

# sort -k 2.6,2.7n -k 2.2,2.3n -k 2.4,2.5n
ABC 010201
PQR 010301
DEF 010202
STU 010302
GHI 020203
JKL 010204
MNO 010208

See? My understanding of the sort(1) man page is
that the keys should have been written as
"-k 2.5,2.6n -k 2.1,2.2n -k 2.3,2.4n" to sort on
the last two digits of the second field and then on
the first two digits of the second field and then on
the middle two digits of the second field.

 I discovered this by compiling the source with the
"-g" option and running it through debug and breaking
in the "numcompare()" function. Unfortunately, this
only seems to work if there is exactly one space between
the two fields. *huh*

Cheers,
Tony Kocurko - Memorial University of Newfoundland





reply via email to

[Prev in Thread] Current Thread [Next in Thread]