Subject: Re: bug#76290: "sort -u" vs "sort -h -u": possible bug

From: Rupert Gallagher <[email-masked]>
Date: Tue, 18 Feb 2025 08:19:25 +0000

According to gnu sort -h -u and what you claim to be common practice, a list of possibly redoundant strings, some beginning with a number, is reduced to an ordered set of the numbered strings only.

Since I expect the resulting ordered set to include the original elements, I will then stop using gnu sort to avoid data loss.

-------- Original Message --------
On 2/18/25 07:25, Paul Eggert <[email-masked]> wrote:

>  On 2025-02-17 15:13, Rupert Gallagher via GNU coreutils Bug Reports wrote:
>  > I expect the program to do exactly what the manual says.
>  
>  Here's what the manual says about -u in
>  <https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html#index-uniquifying-output>:
>  
>  >     Normally, output only the first of a sequence of lines that compare equal....
>  >
>  >     This option also disables the default last-resort comparison.
>  >
>  >     The commands sort -u and sort | uniq are equivalent, but this equivalence does not extend to arbitrary sort options. For example, sort -n -u inspects only the value of the initial numeric string when checking for uniqueness, whereas sort -n | uniq inspects the entire line.
>  
>  This is the part of the manual that you're disagreeing with. The example
>  in my previous email (an example that you did not reply to) is a
>  demonstration of this part of the manual.
>  
>  I am taking the liberty of closing this bug report, as "sort" is
>  behaving as documented here.
>  
>