Computing.Net > Forums > Unix > Date sorting in Unix

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Date sorting in Unix

Reply to Message Icon

Original Message
Name: meatBugle
Date: December 26, 2002 at 10:05:01 Pacific
Subject: Date sorting in Unix
OS: Unix
CPU/Ram: p4 128
Comment:

Can anyone please tell me how to sort dates and times in unix? Also the difference between sed and awk. thank you.


Report Offensive Message For Removal


Response Number 1
Name: David Perry
Date: December 26, 2002 at 12:08:32 Pacific
Reply: (edit)

ls -lst

will produce a list of files sorted by decending time stamps.

The "-M" flag for sort will allow you to treat a field as months.

What do you have to sort?


Report Offensive Follow Up For Removal

Response Number 2
Name: raine
Date: January 7, 2003 at 08:35:34 Pacific
Reply: (edit)

Similar problem to ask help with ^^;

If I have a table of schedules and the fields are:

date activity timestart timeend

And I use awk '/03-feb-2002/' myfile to list my activities for that certain date:

1. how can i sort it so it shows my activities so that the earliest ones show first and then the later ones?

2. how can i make it so that if i supply an argument (let's say a start time), then the result would be all activities starting from that time onwards

3. how can i make it so that if i supply an argument (a range of time) Ex: 10:00am 11:00am (from 10am-11am), then it shows activities falling under there.

Thanks for any help on this!


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History




Data Recovery Software