I have a huge formatted file of the form:
29/01/2010 18:00 string1 string2 .....
30/01/2010 18:30 string3 string4 .....
...
...
dd/mm/yyyy hh:MM strings strings....
I need to perform some statistics based on the dates.
So I would like to substitute the string dd/mm/yyyy hh:MM with epoch time in the file in order to perform simple manipulations.
I suppose that the best way is to use Perl, but I really don’t know where to start. Any hints?
Just that? This quick-and-dirty one-liner should do:
Feed it the file on standard input and it will output the changed version to standard output. All it does is look for lines that have “dd/mm/yyyy hh:mm ” at the start, and feed the date components to the
mktimefunction from thePOSIXmodule to get a unix timestamp.