← Back to team overview

touch-packages team mailing list archive

[Bug 1498973] Re: sort fails to order correctly on CSV files

 

When comparing the full line it gets complicated as certain punctuation chars are ignored in some locales.
Note also the --debug option to indicate the extent of the matches.


** Changed in: coreutils (Ubuntu)
       Status: New => Invalid

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

Title:
  sort fails to order correctly on CSV files

Status in coreutils package in Ubuntu:
  Invalid

Bug description:
  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.

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


References