bug-textutils
[Top][All Lists]
Advanced

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

sort bug


From: Bill Peeler
Subject: sort bug
Date: Wed, 16 Jan 2002 14:32:25 -0700

there appears to be a bug in the sort program.

after inspection of the 23 meg file that i found the problem in, 
it looks like all the records with a single digit for key 2 are sorted
first and then all the records with two digits for key 2, etc.
it also looks like there is a problem when you sort on the last key in the
line
(hence the 'test' field) but i didn't document or test that one much.

fwiw, sort -t , tiny_in -n -b -d -k 2 -k 3 -k 4 -k 5 sorts fine, but only
because the keys are in order...

i built a shell script that demonstrates the problem:

echo > bug.txt
export LANG=""
echo \$LANG=$LANG >> bug.txt
export LC_ALL=POSIX
echo \$LC_ALL=$LC_ALL >> bug.txt
echo >> bug.txt
uname -a >> bug.txt
echo >> bug.txt
sort --version >> bug.txt
echo >> bug.txt
echo "input file:" >> bug.txt
cat tiny_in >> bug.txt
echo >> bug.txt
echo "sort command: sort -t , tiny_in -k 2nbd,2nbd -k 3nbd,3nbd -k 4nbd,4nbd
-k 5nbd,5nbd" >> bug.txt
echo >> bug.txt
echo "output:" >> bug.txt
sort -t , tiny_in -k 2nbd,2nbd -k 3nbd,3nbd -k 4nbd,4nbd -k 5nbd,5nbd >>
bug.txt

i ran it and got the following output:

$LANG=
$LC_ALL=POSIX

Linux davos.i-link.net 2.2.14-5.0smp #1 SMP Tue Mar 7 21:01:40 EST 2000 i686
unknown

sort (GNU textutils) 2.0a
Written by Mike Haertel.

Copyright (C) 1999 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

input file:
3,20020109184710,30,2405,94,test
3,20020109232651,1,2430,14,test

sort command: sort -t , tiny_in -k 2nbd,2nbd -k 3nbd,3nbd -k 4nbd,4nbd -k
5nbd,5nbd

output:
3,20020109232651,1,2430,14,test
3,20020109184710,30,2405,94,test


thanks,

bill
address@hidden




reply via email to

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