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

Re: Sorting by date



on 15:40 Mon 28 Feb, Ron Johnson (ron.l.johnson@cox.net) wrote:
> On 02/28/2011 03:25 PM, Boyd Stephen Smith Jr. wrote:
> >On Monday 28 February 2011 14:35:26 erikmccaskey64 wrote:
> >>Original:
> >>Jan 23 2011 10:42 SOMETHING 2007.12.20.avi
> >>Jun 26 2009 SOMETHING 2009.06.25.avi
> >>Feb 12 2010 SOMETHING 2010.02.11.avi
> >>Jan 29 2011 09:17 SOMETHING 2011.01.27.avi
> >>Feb 11 2011 20:06 SOMETHING 2011.02.10.avi
> >>Feb 27 2011 23:05 SOMETHING 2011.02.24.avi
> >>
> >>
> >>Output:
> >>Feb 27 2011 23:05 SOMETHING 2011.02.24.avi
> >>Feb 11 2011 20:06 SOMETHING 2011.02.10.avi
> >>Jan 29 2011 09:17 SOMETHING 2011.01.27.avi
> >>Jan 23 2011 10:42 SOMETHING 2007.12.20.avi
> >>Feb 12 2010 SOMETHING 2010.02.11.avi
> >>Jun 26 2009 SOMETHING 2009.06.25.avi
> >>
> >>
> >>How could I get the output where the newest file is at the top?
> >
> >First, pre-process the original to use ISO-standard date format: %Y-%m-%d.
> >That's 4-digit year, dash, 2-digit month, dash, 2-digit day.
> >
> >Now, (LC_ALL=C sort<  input.pp>  output.pp) will give you things sorted.
> >Reverse the pre-processing to have "pretty" dates if you like.
> >
> 
> That's an awful lot of effort when ls has a "sort by date" argument.

That assumes (and OP hasn't mentioned in any of his posts of this same
question to the Ubuntu, CentOS, and Debian mailing lists) that output
are from 'ls'.  

    https://encrypted.google.com/search?q=%22Jan+23+2011+10%3A42+SOMETHING+2007.12.20.avi%22

The format of the output makes me suspect that it isn't.

-- 
Dr. Ed Morbius, Chief Scientist /            |
  Robot Wrangler / Staff Psychologist        | When you seek unlimited power
Krell Power Systems Unlimited                |                  Go to Krell!


Reply to: