Prepare CSV files


Generate CSV data files to be used by the CSV processing task. Each file has rows with the 3rd column being increasing numbers. The number in the last row of each file contains the seriel number of the file. That will make the sum of the numbers different and we'll be able to verify if the results come from the different files.

examples/forks/prepare_files.pl
use strict;
use warnings;

my ($n, $size) = @ARGV;
die "Usage: $0 NUMBER_OF_FILES  SIZE_OF_FILES\n" if not defined $size;

my $content = "";
my $cnt = 0;
while ($cnt < $size) {
    $cnt++;
    $content .= "a,b,$cnt,c,d\n";
}

for my $ix (1..$n) {
    my $filename = sprintf "data_%02s.csv", $ix;
    #print "$filename\n";
    open my $fh, '>', $filename or die "Could not open $filename\n";
        print $fh $content;
        print $fh "a,b,$ix,c,d\n";
}

perl prepare_files.pl 12 2000000