LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can I sort this list by Month then Day order (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-sort-this-list-by-month-then-day-order-4175436910/)

Glenn D. 11-13-2012 04:51 AM

How can I sort this list by Month then Day order
 
Hello,
How can I sort this list {below} by Month then Day order
-Thanks Glenn

01-Aug-2012
01-Oct-2012
02-Nov-2012
03-Nov-2012
03-Oct-2012
04-Nov-2012
04-Oct-2012
04-Sep-2012
05-Nov-2012
05-Oct-2012
06-Nov-2012
06-Oct-2012
07-Oct-2012
08-Nov-2012
08-Oct-2012
09-Nov-2012
09-Oct-2012
10-Nov-2012
10-Oct-2012
11-Nov-2012
11-Oct-2012
12-Nov-2012
12-Oct-2012
13-Nov-2012
13-Oct-2012
14-Aug-2012
15-Oct-2012
16-Oct-2012
17-Aug-2012
17-Oct-2012
17-Sep-2012
18-Oct-2012
19-Oct-2012
22-Oct-2012
22-Sep-2012
23-Oct-2012
23-Sep-2012
24-Oct-2012
24-Sep-2012
25-Oct-2012
25-Sep-2012
26-Oct-2012
26-Sep-2012
27-Jul-2012
27-Oct-2012
27-Sep-2012
28-Jun-2012
28-Oct-2012
29-Oct-2012
29-Sep-2012
30-Aug-2012
30-Jun-2012
30-Oct-2012
30-Sep-2012
31-Oct-2012

druuna 11-13-2012 05:00 AM

Have a look at this:
Code:

sort -t- -M -k2 infile
I do believe the first column is also sorted, if not:
Code:

sort -t- -M -k2 -k1 infile


All times are GMT -5. The time now is 01:38 PM.