GNU bug report logs -
#76290
"sort -u" vs "sort -h -u": possible bug
Previous Next
Full log
Message #31 received at 76290-done <at> debbugs.gnu.org (full text, mbox):
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 <eggert <at> cs.ucla.edu> 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.
>
>
This bug report was last modified 92 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.