Public bug reported:

Using latest coreutils 8.21-1ubuntu5.1 on Trusty, installed via apt-get
from the standard repositories.

Given a file of UK postcodes which includes an erroneous (shorted) one,
e.g.

AB234DA
CA87BJ
BA23NN
AB234D
BA572LD
AB234DA

The command 'sort filename' correctly orders the file:

AB234D
AB234DA
AB234DA
BA23NN
BA572LD
CA87BJ

Note the shorter of the set of "AB234D" matches is at the start of the
file.

However, if the file is a .csv file with lines such as:
"Some string",AB234DA,15,29.1,"another string",45.2,66.7,19,NULL,hello,99,0,1

...the command 'sort -k2 -d -t","' doesn't handle the shorter string
correctly, so it results in:

"Some string",AB234DA,15,29.1,"another string",45.2,66.7,19,NULL,hello,99,0,1
"Some string",AB234D,15,29.1,"another string",45.2,66.7,19,NULL,hello,99,0,1
"Some string",AB234DA,15,29.1,"another string",45.2,66.7,19,NULL,hello,99,0,1
"Some string",BA23NN,15,29.1,"another string",45.2,66.7,19,NULL,hello,99,0,1
"Some string",BA572LD,15,29.1,"another string",45.2,66.7,19,NULL,hello,99,0,1
"Some string",CA87BJ,15,29.1,"another string",45.2,66.7,19,NULL,hello,99,0,1


Note that AB234D is left between its longer relatives, whereas it should appear 
first.

** Affects: coreutils (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: sort

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1498973

Title:
  sort fails to order correctly on CSV files

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/1498973/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to