in reply to processing a lot of files
I think you want something like this (untested):
my $dir = 'C:/Documents and Settings/mydir/Desktop/current/Test_Files' +; open my $out, '>', "$dir/data.txt" or die "can't open out file: $!"; opendir my $dh, $dir or die "can't opendir $dir : $!"; while(my $f = readdir($dh)) { next if ($f eq 'data.txt'); open my $fh, '<', "$dir/$f" or die "can't open file $f : $!"; my $first_line = <$fh>; while (my $line = <$fh>) { chomp $line; my ($well,$sample,$barcode,$block_id) = split(/\t/, $line); my $name = substr($block_id, 11); $sample =~ /(\d+)(.*)/; print $outfile "$well\t$1\t$2\$barcode\t$name\n"; } close $fh; } closedir $dh; close $out;
Notes:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: processing a lot of files
by lomSpace (Scribe) on Jul 28, 2009 at 21:25 UTC | |
by toolic (Bishop) on Jul 29, 2009 at 00:20 UTC | |
by scorpio17 (Canon) on Jul 29, 2009 at 13:11 UTC |