Thank you for the tips you guys!
Got it to work now.
In case anyone is interested, this is the code I ended up with:
#!perl use strict; use warnings; use autodie; # die if problem reading or writing a file my $input = 'C:/Some/specific/path/to/inputfile.txt'; my $dir = 'C:/Some/specific/folder'; open FILEin, $input; binmode(FILEin); my $first_line_indicator = 1; while (my $line = <FILEin>){ if ($first_line_indicator==1){ my @files = <$dir/*>; my $countfiles = @files; my $outfile = $dir.'/bladibla_'.$countfiles.'.txt'; open FILEout, '>'.$outfile; print FILEout $line; $first_line_indicator=0; }else{ print FILEout $line; close FILEout; $first_line_indicator=1; } } close FILEin;
In reply to Re: Splitting big file or merging specific files?
by zarath
in thread Splitting big file or merging specific files?
by zarath
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |