[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
Simon Williams wrote: Does this file fit in memory? > Tue Jan 8 04:53:47 GMT 2008 Date::Calc / Date::Manip in Perl will ahve something for that. > Not particularly nice. I'm sure PHP's strtotime function would probably > be able to read that, but I need something I can use in a shell script. > > Secondly, the file is in the format: > date/time as above > arbitrary text > blank line Is there a blank line at the end? If you set $/ (record separator) to "" (empty string, not undef) in Perl, it'll go into paragraph mode. You can then whip the first line off, parse it with Date::?::?, use it as a hash key and sort the keys before mapping it it back. You could do it in one line with a Schwatzian Transform or similar. Let me know if you need a hand. Steve -- The Mailing List for the Devon & Cornwall LUG http://mailman.dclug.org.uk/listinfo/list FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html