open(my $out, ">C:/Documents and Settings/mydir/Desktop/ltvec_data.txt +"); my $first_line = <DATA>; chomp $first_line; while(<DATA>){ chomp; my @fields = split /\t/; my $well_position = $fields[0]; my $sample = $fields[1]; $sample =~ /(\d+)(.*)/; my $barcode = $fields[2]; my $block_id = $fields[3]; my $name = substr($block_id,11); print $out "$well_position\t$1\t$2\t$barcode\t$name\n"; } close $out; __DATA__ Position Sample Barcode A01 12032 B1 NUBI825632 XXXXX Glyc 01/07/2009 B01 12032 L1 NUBI825757 XXXXX Glyc 01/07/2009 C01 12032 L2 NUBI825872 XXXXX Glyc 01/07/2009 D01 12032 L3 NUBI825997 XXXXX Glyc 01/07/2009 E01 12166 B1 NUBI826118 XXXXX Glyc 01/07/2009
my $_dir = 'C:/Documents and Settings/mydir/Desktop/current/Test_Files +'; open(my $out, ">C:/Documents and Settings/mydir/Desktop/current/Test_F +iles/data.txt"); opendir my $dh, "$dir"; # read files in dir #my $first_line = <IN>; #chomp $first_line; #my $i=1; while(my $f = readdir($dh)){ chomp; my @fields = split /\t/; my $well_position = $fields[0]; my $sample = $fields[1]; $sample =~ /(\d+)(.*)/; my $barcode = $fields[2]; my $block_id = $fields[3]; my $name = substr($block_id,11); my $outfile = "$out$name"; print $outfile "$well_position\t$1\t$2\t$barcode\t$name\n"; } closedir($dh); </readmore>
In reply to processing a lot of files by lomSpace
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |