Re: Sorting Question

From: Jef Lee (jef.lee@ITVISION.COM.AU)
Date: Tue Jan 13 2004 - 04:35:38 EST


This does it:
 ls -1 | sort -n -t"." -k 3.5,3.8 -k 3.1,3.4

Jef...

-----Original Message-----
From: IBM AIX Discussion List [mailto:aix-l@Princeton.EDU] On Behalf Of
David Antrobus
Sent: Tuesday, January 13, 2004 4:24 PM
To: aix-l@Princeton.EDU
Subject: Re: Sorting Question

What it sounds like to me is you want to sort by date.

Would a basic "ls -ltr" work?

_______________________________
David Antrobus
AIX Systems Administrator
Caudwell Distribution Group

-----Original Message-----
From: Mills, John T [mailto:John.T.Mills@ERAC.COM]
Sent: 12 January 2004 21:29
To: aix-l@Princeton.EDU
Subject: Re: Sorting Question

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

***************************************************************
Disclaimer :-
This email is confidential and intended solely for the use of the
individual to whom it is addressed. Any views or opinions are solely
those of the author and do not necessarily represent those of 20:20
Logistics Ltd, Dextra Solutions Ltd, The Discovery Store Ltd, The Mobile
Phone Repair Company Ltd and Caudwell Group. If you are not the intended
recipient, be advised that you have received this email in error and
that any use, dissemination, forwarding, printing or copying is strictly
prohibited. If you have received this email in error please delete it
from your system and notify the sender immediately.
***************************************************************



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