-1
How to format date for file content using linux command line tools?
Input:
aaa;1.70;ccc;20.01.13;zz;2013;
uuu;2.70;lll;17.12.10;zz;2013;
fff;3.70;nnn;31.01.98;zz;2013;
auu;8.70;nuu;30.02.96;zz;2013;
Output:
aaa;1.70;ccc;20.01.2013;zz;2013;
uuu;2.70;lll;17.12.2010;zz;2013;
fff;3.70;nnn;31;01.1998;zz;2013;
auu;8.70;nuu;30.02.1996;zz;2013;
Can you comment, how it works? It does well with example, but when I put longer row with multiple dates, it somehow gives 01.01.1970 in the end of the row. Would like that it changes date format for column wich is number 12. and after column 12 there are other 10 columns. Dates should be changed in column 12 and 15. Other fields/columns should not be changed. – Maris – 2013-12-16T12:33:27.397
Works like charm! Only I seperated for my $i (11) and second time I take for my $i (14), did not worked together 11..14, Error parsing time at /usr/lib/perl/5.14/Time/Piece.pm line 469, <> line 1.:) – Maris – 2013-12-17T09:22:20.150