Re: Sorting Question

From: Bill Verzal (BVerzal@KOMATSUNA.COM)
Date: Mon Jan 12 2004 - 17:04:24 EST


 sort -rn -k5,3 -t"." [filename]
--------------------------------------------------------

"If everything is coming your way, then you are in the wrong lane"

Bill Verzal
AIX Administrator, Komatsu America
(847) 970-3726 - direct
(847) 970-4184 - fax

             "Mills, John T"
             <John.T.Mills@ERA
             C.COM> To
             Sent by: IBM AIX aix-l@Princeton.EDU
             Discussion List cc
             <aix-l@Princeton.
             EDU> Subject
                                       Re: Sorting Question

             01/12/2004 03:28
             PM

             Please respond to
                  IBM AIX
              Discussion List
             <aix-l@Princeton.
                   EDU>

Yes I looked at that first. The output is not correct.

sort -nr does a sort from left to right, sorting
12302003
12292003
...
01102004

What I really need to do is sort on the last 4, then on the first
4 characters. Unfortunately "filename" varies in length.

Any thoughts?

Thanks,

John

-----Original Message-----
From: IBM AIX Discussion List [mailto:aix-l@Princeton.EDU]On Behalf Of
John Jolet
Sent: Monday, January 12, 2004 2:07 PM
To: aix-l@Princeton.EDU
Subject: Re: [aix-l] Sorting Question

sort -nr.
On Mon, 2004-01-12 at 13:56, Mills, John T wrote:
> Give an output of 'ls -1 .':
>
> filename.image.01102004
> filename.image.12252003
> filename.image.12262003
> filename.image.12272003
> filename.image.12282003
> filename.image.12292003
> filename.image.12302003
>
> How could I use sort or/and awk to sort the list like this?
>
> filename.image.12252003
> filename.image.12262003
> filename.image.12272003
> filename.image.12282003
> filename.image.12292003
> filename.image.12302003
> filename.image.01102004
>
> Thanks,
>
> John T. Mills



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:29 EDT