Sort an array which contains date formatted elementsby msk_0984 (Friar)
|on Jul 17, 2007 at 12:07 UTC||Need Help??|
msk_0984 has asked for the
wisdom of the Perl Monks concerning the following question:
Hi Respected Monks,
This one is mine and I am sorry for my last question. Any ways I am greping out filenames from a particular directory and displaying all the file contents which are nothing but log file. But my file names are being created day wise ... Because of which the filenames are not getting sorted and it is displaying the logs in a incorrect order.
Fri Jul 13 00:25:16 2007 india01 Syslog_Probe Properties file backup taken successfully
Fri Jul 13 00:25:16 2007 india01 ObjectServer Successfully Changed to MSK_P
Sat Jul 7 14:33:02 2007 india01 Stopping the PAD
Sat Jul 7 14:33:10 2007 india01 Starting the PAD
Sat Jul 9 15:17:51 2007 station18 Install login failed
Sat Jul 10 10:17:51 2007 station18 Install Interface entry
Sat Jul 11 00:33:02 2007 india01 Stopping the PAD
The output is coming in an incorrect order because the filenames grep out are coming in an incorrect order. So wat I did was sorted that array
So the output is still not in sorted order it is taking the elements as strings even though i gave it to sort in numerical way. So how to sort that array in keep that array in sorted order according to dates as
Thanks in advance ..