Hi,
I have a file as below
I need to overwrite the 2 nd column alone to numeric format like "06122011030414012345" as per the timestamp value
output file should be
the microseconds can be neglected if required.
Any help will be appreciated.
Thanks in advance
If you mean date to Unix epoch,
with standard modules you could use
something like this:
perl -MTime::Local -F'\|' -lane'BEGIN {
@m{
qw[Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec]
} = 0 .. 11;
}
@dt = split /[\. -]/, $F[1];
$dt[3] += 12 if $dt[7] eq "PM";
$F[1] =
timelocal $dt[5], $dt[4], $dt[3], $dt[0],
$m{$dt[1]}, ($dt[2] > 69 ? 2000 : 1900) + $dt[2] - 1900;
print join "|", @F;
' infile