Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-18-2010, 12:45 PM   #1
LQ Newbie
Registered: Jul 2010
Posts: 24

Rep: Reputation: 15
sorting date

in my text file of 5 columns 2 column is in DDMMYYYY format. (ie DATE OF BIRTH).
how to use sort command for its assending order and decending order.

Is the same can be use for the date format YYYYMMDD ?

Pl guide
Old 08-18-2010, 12:59 PM   #2
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 100Reputation: 100
Read the manpage of 'sort', -k option.
Old 08-18-2010, 09:53 PM   #3
Senior Member
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
sample contents please
Old 08-18-2010, 09:55 PM   #4
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
As pointed out by quanta you can use the -k option to specify which column tp base the sort on. Additionally you can use -r to reverse the sort order.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting photos into folders based on exif date SuperJediWombat! Programming 7 05-16-2009 07:53 PM
Setting system date and time affecting the clock and date on BIOS satimis Ubuntu 7 09-21-2007 09:02 AM
Sorting all files of home folder modified after a specific date for backup fc6_user Linux - General 2 03-30-2007 03:24 AM
what is the correct syntax order for tar with --after-date DATE, --newer DAT farhan Linux - General 1 03-16-2007 09:43 AM
Sorting files by time / date. TheRealDeal Linux - General 2 08-06-2006 10:35 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:58 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration