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? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20110228/f49ea424/attachment.html>
On Mon, Feb 28, 2011 at 3:35 PM, erikmccaskey64 <erikmccaskey64 at zoho.com> wrote:> How could I get the output where the newest file is at the top?man ls, -t sort by modification time HTH,
On Mon, Feb 28, 2011 at 3:35 PM, erikmccaskey64 <erikmccaskey64 at zoho.com> wrote:> > Original: > Jan 23 2011 10:42 SOMETHING 2007.12.20.avi[snip]> 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?If this is a text file, you can seed an array with the month names as the index then sort using that index...
At Mon, 28 Feb 2011 12:35:24 -0800 CentOS mailing list <centos at centos.org> 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?ls -lt man ls> > > MIME-Version: 1.0 > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos > >-- Robert Heller -- 978-544-6933 / heller at deepsoft.com Deepwoods Software -- http://www.deepsoft.com/ () ascii ribbon campaign -- against html e-mail /\ www.asciiribbon.org -- against proprietary attachments
On Mon, Feb 28, 2011 at 12:35 PM, erikmccaskey64 <erikmccaskey64 at zoho.com> 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? >You keep asking your questions in (at least) both CentOS and Ubuntu lists. Which OS are you using? More importantly, have you considered looking things like this up in the man pages, then on the web where really basic questions like this are easily found, with answers?
On 2/28/11 12:35 PM, 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?Assuming you are getting the time from the ls -l command... To sort within the ls command (man ls): ls -lt To sort after the ls command (man ls): ls -al --full-time | awk '{print $6 " " $7 " " $9}' | sort -r Not using ls: To take that input and sort you'd have to do some hashing to translate the months to a sortable format (like numbers) I think. Alternatively, you could use the listed date to generate a UTF date via the date command. ~Sean