1
2
perl -MPOSIX -E'scalar <> for 1..2;say "ID,datumaktuel";say ++$id,",",strftime("%Y%m%d",localtime),"," while <>' < test.csv > firstcols.tmp
paste firstcols.tmp test.csv > test-converted.csv
rename output.csv input.csv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!C:/Programme/Perl
use warnings;
use strict;
use Text::CSV_XS;
my $file_in = 'ausgang.csv';
my $file_out = 'eingang.csv';
my $csv = Text::CSV_XS->new( { binary => 1 } ) or die "Cannot use CSV: ".Text::CSV->error_diag();
open my $fh_in, '<:encoding(utf8)', $file_in or die $!;
open my $fh_out, '>:encoding(utf8)', $file_out or die $!;
my @felder = ( 'ID', 'datumaktuel', 'datum','name');
$csv->print( $fh_out, \@felder );
}