On Wed, 10 Jan 2007, Bill McCarthy wrote:
On Tue 9-Jan-07 4:12pm -0600, Arun Easi wrote:
On Tue, 9 Jan 2007, Bill McCarthy wrote:
I thought I knew the unix sort utility fairly well. I'm a
bit baffled.
I wrote a simple program to generate 1,000 records with just
random dates (month 1-12, day 1-30, year 1976-2007).
Sorting with:
:%!sort -t/ -k3
and
:%!sort -t/ -k3.1n,3.4 -k1n,2
produced identical correct results!
Lines with same 3rd field are sorted lexicographically.
So, if you have MM/DD/YYYY format, that should be good. If
you have DD/MM/YYYY, it cannot be (Try adding 31/11/1996
and 01/12/1996).
Is this documented behavior? It certainly isn't mentioned
in the brief docs that come with the GnuWin32 version. Do
you have a URL that documents this?
http://docs.hp.com/en/B9106-90007/sort.1.html
Search for "final key"
regards,
-Arun