bug-gnu-utils
[Top][All Lists]
Advanced

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

sort: bug in handling of -k r.s,x.y


From: Walter Belgers
Subject: sort: bug in handling of -k r.s,x.y
Date: 23 Aug 2001 12:16:35 GMT
User-agent: slrn/0.9.6.3 (SunOS)

Hi,

I think I've found a bug in sort. When using the field.character
notation in the -k option, all works fine when sorting the first field.
However, for fields 2 and up, specifying a begin and end character
within the field does not work correctly.

To clarify, look at this typescript:

Script started on Thu Aug 23 14:01:58 2001
[~] address@hidden> ./sort --version
sort (GNU textutils) 2.0
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.
[~] address@hidden> cat file
qu kba
ow mdf
sx oai
lt nhe
my jfd
nt pgc
jv lcg
ks qeb
pz sih
[~] address@hidden> ./sort -k 1.1,1.1 file      # this works
jv lcg
ks qeb
lt nhe
my jfd
nt pgc
ow mdf
pz sih
qu kba
sx oai
[~] address@hidden> ./sort -k 1.2,1.2 file      # works also
ks qeb
lt nhe
nt pgc
qu kba
jv lcg
ow mdf
sx oai
my jfd
pz sih
[~] address@hidden> ./sort -k 2.2,2.2 file      # sorts char _1_ in field 2!!
my jfd
qu kba
jv lcg
ow mdf
lt nhe
sx oai
nt pgc
ks qeb
pz sih
[~] address@hidden> ./sort -k 2 file            # sorts field 2 (works)
my jfd
qu kba
jv lcg
ow mdf
lt nhe
sx oai
nt pgc
ks qeb
pz sih
[~] address@hidden> ./sort -k 2.3,2.3 file      # sort char _2_, not 3!!
sx oai
qu kba
jv lcg
ow mdf
ks qeb
my jfd
nt pgc
lt nhe
pz sih
[~] address@hidden> ./sort -k 2.1,2.1 file      # sorts on field 1?!
jv lcg
ks qeb
lt nhe
my jfd
nt pgc
ow mdf
pz sih
qu kba
sx oai
[~] address@hidden> exit
Script done on Thu Aug 23 14:03:01 2001

This behaviour is incorrect according to the POSIX standard.

On Solaris 2.8, AIX 4.3 and DG/UX 4.0 I get similar results. The
HP-UX 10.20 sort gives correct output for -k 2.1,2.1 but for
character values of 2 and higher gives the same false results.

Regards,
Walter.
-- 
ir. Walter Belgers      AT Computing, Nijmegen, Netherlands +31(0)243527226
http://www.belgers.com/  Youth is not a time in life, it is a state of mind



reply via email to

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