[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: sort 5.97 bug sorting a month embedded in a field
From: |
Gordon Grimes |
Subject: |
RE: sort 5.97 bug sorting a month embedded in a field |
Date: |
Tue, 26 Sep 2006 20:52:11 -0700 |
Eric,
I don't see it set in the cygwin environment. That said, everything
sorts fine if it's not embedded in a field. I eventually had to do
this:
cat dates | sed 's%-% %g' | sort -k4 -k3M -k2n > sorted
after the following failed:
sort -k2.8n -k2.4,2.6M -k2.1,2.2n
Can you get it to work with embedded values?
Thanks,
gordon
-----Original Message-----
From: Eric Blake [mailto:address@hidden
Sent: Tuesday, September 26, 2006 7:46 PM
To: Gordon Grimes
Cc: address@hidden
Subject: Re: sort 5.97 bug sorting a month embedded in a field
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Gordon Grimes on 9/26/2006 6:01 PM:
> Hi,
> I'm unable to get "M" (month) to sort from within a field. See below.
> (I have 18 years experience with 'sort')
>
> [529] > cat dates
> 142 01-APR-2006
> 16 01-DEC-2005
> 31 01-FEB-2006
> 13 01-JAN-2006
> 55 01-MAR-2006
> 13312 01-MAY-2006
> 1 01-NOV-2005
> 1 01-OCT-2005
> 145 02-APR-2006
> 13 02-DEC-2005
> [533] > cat may_dates | sort -k2.4,2.6M ## should work
Useless use of cat. Try:
sort -k2.4,2.6M may_dates
to save a process.
> 1 01-NOV-2005
> 1 01-OCT-2005
> 13 01-JAN-2006
> 13 02-DEC-2005
> 16 01-DEC-2005
> 31 01-FEB-2006
> 55 01-MAR-2006
> 142 01-APR-2006
> 145 02-APR-2006
> 13312 01-MAY-2006
What's your locale? And if it is not C, does 'LC_ALL=C sort' behave
differently?
- --
Life is short - so eat dessert first!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFGeXO84KuGfSFAYARAp11AKCXgAwtQsc1Fjjv1pxwA1YNsQav3gCgrdgs
LYMUafIVPb9OhYtEo6Bq/BQ=
=qK5o
-----END PGP SIGNATURE-----