CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Sort by date and time, print todays data

 



sidsinha
New User

Aug 14, 2013, 9:03 PM

Post #1 of 2 (561 views)
Sort by date and time, print todays data Can't Post

Hi,
How could I do a multi sort i.e first sort by date, then sort by time, then print only the entries for todays date from the file

Below is how the file looks like:
Date Time Tag
08-13-2013 19:22:16 Yes
08-13-2013 18:22:17 No
08-13-2013 21:22:17 Yes
08-13-2013 20:22:16 Yes
08-13-2013 23:22:18 Yes
08-13-2013 22:22:17 No
08-14-2013 01:22:17 Yes
08-14-2013 00:22:18 Yes
08-14-2013 03:22:19 No
08-14-2013 02:22:18 Yes
08-14-2013 05:22:28 No
08-14-2013 04:22:29 Yes
08-14-2013 07:22:19 Yes
08-14-2013 06:22:18 Yes
08-14-2013 09:22:19 No
08-14-2013 08:22:19 Yes
08-14-2013 11:22:19 Yes
08-14-2013 10:22:20 No
08-14-2013 13:22:20 Yes
08-14-2013 12:22:20 No
08-14-2013 15:22:21 Yes
08-14-2013 14:22:20 Yes
08-14-2013 17:22:21 Yes
08-14-2013 16:22:22 No

[download]
The output needs to be sorted by date first and then by time.Thanks


Laurent_R
Veteran / Moderator

Aug 15, 2013, 3:50 AM

Post #2 of 2 (558 views)
Re: [sidsinha] Sort by date and time, print todays data [In reply to] Can't Post

This has been answered in your cross post on Perl Monks.

And, as I told you in your cross post on Dev Shed, you don't need to sort on dates if you are going to keep only the records with today's dates. Filter out the other records first and sort the full records.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives