
effc
Novice
Nov 1, 2012, 5:39 AM
Post #1 of 4
(2312 views)
|
Could you check this script? Keeps churning out files that are 0kb
|
Can't Post
|
|
Hi I'm searching through a directory of files that are about 700kb a piece for the string ^ASSAY=BLAH_BLAH_BLAH, I need to replace the BLAH_BLAH_BLAH with CHA21 (and add.manual, which is working properly). The files that I come up with are 0kb. #!/usr/bin/perl opendir(FILES, ".") || die; #open current directory foreach (readdir(FILES)) { { $next_file = $_; chomp($next_file); print "$nextfile.$suffix\n"; if ($next_file =~ m/.sift/) { open (IN, "<$next_file" || die); print "$next_file\t"; $next_file=~ s/\.sift//; print "$next_file.manual.sift\n"; open (OUT, ">$next_file.manual.sift" || die); while ($line = <IN>) { if($line =~ /^ASSAY=BLAH_BLAH_BLAH/){ $line =~ s/BLAH_BLAH_BLAH/CHA21/gi; } } } close OUT; close IN; } # close OUT; # close IN; } Thanks in advance!
|