Code:
$ cat infile
2,"102343454",5060,"579668","579668","579668","SIP",,,"825922","035885221283026",1,268,"00:59:00.782 APR 17 2012","00:59:00.815 APR 17 2012","01:03:28.550 APR 17 2012",1,"M10",1,"M10",1,"core-veraz","core-hammer","localhost:325184","G729","audio","core-hammer","3045684523",10012,"4958033045",61696,"core-veraz","560584321",61698,"6540340321",10012,0,0,0,0,0,0,0,0,0,0,0,0,"325185","G449","CAT","coreB","100109148213",10012,"106504021",61698,"coreA","10.50.0.1",61696,"10.0.0.0",10012,0,0,0,0,0,0,0,0,0,0,0,0,,,,,"0.0.0.0",0,"0.0.0.0",0,,"0.0.0.0",0,"0.0.0.0",0,0,0,0,0,0,0,0,0,0,0,,,,,
$ cat script.pl
use warnings;
use strict;
use Text::CSV_XS;
die qq[Usage: perl $0 <input-file> <output-file>\n] unless @ARGV == 2;
open my $ofh, q[>], pop or die qq[Open: $!\n];
my %month;
{
my $month;
%month = map { $_ => sprintf q[%02d], ++$month }
qw( jan feb mar apr may jun jul aug sep oct nov dec );
}
## Date fields are 13..15
my $csv = Text::CSV_XS->new();
while ( my $row = $csv->getline( \*ARGV ) ) {
for ( @$row[13 .. 15] ) {
my @f = split;
$f[1] = $month{ lc $f[1] };
$_ = join q[], @f;
}
$csv->print( $ofh, $row );
print $ofh qq[\n];
}
$ perl script.pl infile outfile
$ cat outfile
2,102343454,5060,579668,579668,579668,SIP,,,825922,035885221283026,1,268,00:59:00.78204172012,00:59:00.81504172012,01:03:28.55004172012,1,M10,1,M10,1,core-veraz,core-hammer,localhost:325184,G729,audio,core-hammer,3045684523,10012,4958033045,61696,core-veraz,560584321,61698,6540340321,10012,0,0,0,0,0,0,0,0,0,0,0,0,325185,G449,CAT,coreB,100109148213,10012,106504021,61698,coreA,10.50.0.1,61696,10.0.0.0,10012,0,0,0,0,0,0,0,0,0,0,0,0,,,,,0.0.0.0,0,0.0.0.0,0,,0.0.0.0,0,0.0.0.0,0,0,0,0,0,0,0,0,0,0,0,,,,,