bug-coreutils
[Top][All Lists]
Advanced

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

bug#23665: spaces in keys: doc, --debug in LC_ALL=C


From: Assaf Gordon
Subject: bug#23665: spaces in keys: doc, --debug in LC_ALL=C
Date: Tue, 31 May 2016 22:15:22 -0400

> On May 31, 2016, at 20:54, Pádraig Brady <address@hidden> wrote:
> 
> On 01/06/16 01:38, Assaf Gordon wrote:
>> 
>> 2. add a bit more verbose progress information to the 'sort-debug-warn.sh' 
>> test - just so it'll be easier to discuss to the changed messages.
>> 
>> 3. removes the 'maybe_space_aligned' and modifies the condition a bit.
> 
> 2 and 3 are good to push.

Thank you, pushed in:
 
http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=d548f87595a193e21b170368bc8fc2ded4dadb73
 
http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=6223bf94bfeac75fb4252095864a80545ba00a0d

====

Regarding documentation: how about the following?

'sort' without '-t' separates fields by whitespace (tab and space characters) 
and considers the whitespace characters to be part of the field's text. Use 'b' 
sorting option to skip leading spaces.

Example:

   $ cat  s.txt
   M A
   M  C
   M   D
   M  B

Without 'b' leading spaces affect sorting order of the second field:

   $ LC_ALL=C sort -k2 s.txt
   M   D
   M  B
   M  C
   M A

With 'b', leading spaces are skipped:

   $ LC_ALL=C sort -k2b s.txt
   M A
   M  B
   M  C
   M   D

For troubleshooting use 'sort --debug':

   $ LC_ALL=C ./src/sort --debug -k2 s.txt 
   sort: using simple byte comparison
   sort: leading blanks are significant in key 1; consider also specifying 'b'
   M   D
    ____
   _____
   M  B
    ___
   ____
   M  C
    ___
   ____
   M A
    __
   ___

=========

Should such an example go in the documentation, or in the new 'gotcha' page ?

I can shorten the example (e.g. with only two letter, such as 'printf "A\n 
B\n"'), but perhaps a slightly longer more verbose example would help 
understand the issue in a glance.
The fixed first field "M" is there to make it visually clear where the spaces 
are.

comments welcomed,
 - assaf










reply via email to

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