NetBSD-Bugs archive

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

Re: bin/51726: sort -n ignored if given after -k



The following reply was made to PR bin/51726; it has been noted by GNATS.

From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/51726: sort -n ignored if given after -k
Date: Sun, 18 Dec 2016 02:02:29 +0000

 On Sat, Dec 17, 2016 at 05:20:00PM +0000, abs%absd.org@localhost wrote:
  > If -n is given after -k on the command line it appears to be ignored.
  > 
  > I found a script which was running "sort -k 3 -n -r"
 
 If you're using -k you're supposed to put the key flags in the -k
 argument, that is, sort -k 3nr.
 
 Technically I think if you write -k 3 -n -r and it doesn't honor the
 -n it's doing what you asked. And I think if you write -k 3 -n -r and
 it *does* sort in reverse order, then *that*'s a bug. sigh.
 
 sort's argument handling is a trainwreck. And thus the code in sort
 that deals with it is horrifying. I know why POSIX wanted to get rid
 of "sort +3", but it *worked*...
 
 -- 
 David A. Holland
 dholland%netbsd.org@localhost
 


Home | Main Index | Thread Index | Old Index