[Top][All Lists]

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

Re: posix sort bug

From: Jim Meyering
Subject: Re: posix sort bug
Date: Fri, 18 Jan 2002 08:56:26 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.2.50 (i686-pc-linux-gnu)

Hi Tom,
[Bill, it looks like your problem is similar]

I think you're misreading the spec.
It says that if any per-key option is specified, then
that overrides all global ordering options for that key.

    The following options shall override the default ordering rules.
    When ordering options appear independent of any key field
    specifications, the requested field ordering rules shall be applied
    globally to all sort keys. When attached to a specific key (see -k),
    the specified ordering options shall override all global ordering
    options for that key.

    [...descriptions of -d, -f, etc....]

> In sort from GNU textutils 1.14, option processing seems to not work
> quite right, though perhaps I'm misreading the Posix spec.
> For example, I think that:
>       sort -r -t - -k 1 -k 2n
> should have the same meaning as:
>       sort -t - -k 1,1r -k 2,2rn
> but it does not seem to.  (The latter invocation works as I would
> expect, the former does not.)  Enclosed is some sample input which
> illustrates the problem:

Solaris8's /bin/sort behaves the same way GNU sort does in this respect:

  # The `n' makes sort ignore the global `-r'.
  $ printf '23\n2\n10\n'|/bin/sort -r -k 1,1n

  # The `r' makes sort ignore the global `-n'.
  $ printf '23\n2\n10\n'|/bin/sort -n -k 1,1r

  $ printf '23\n2\n10\n'|/bin/sort -k 1,1nr

BTW, textutils-1.14 is almost six(!) years old.
Why on earth are you using (not to mention taking
the time to report bugs in) that version?

The latest is here:

reply via email to

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