my $dir = 'c:/perl_scripts/testing'; my $fsearch = "$dir/input.txt"; my $ssearch = "$dir/isearch.txt"; my $countsection = 1; my $count = 0; my $line; # Opens file with search items open (OFILE,"<$ssearch")||die "Could not open input file isearch.txt\n +"; # Opens file with list of files to be searched open (INFILE,"<$fsearch")||die "Could not open input file input.txt\n" +; while($sitem = <OFILE>) { chomp $sitem; @newterm = split (/\-/, $sitem); $term = $newterm[0]; while($sigfile = <INFILE>){ chomp $sigfile; open (TEXTFILE, "<$dir/$sigfile") || die "\nCAN'T OPEN $fsearc +h\n"; #Create NEW File to output Revised Data open(COMBINE_FILE, ">>$dir/REVISE_$sigfile")|| die "\nCAN'T OPEN R +EVISE_$sigfile\n"; while($line = <TEXTFILE>) { chomp $line; my @sepdata = split (/\s+/, $line); if($sepdata[0] eq "+") { $countsection++; } #Prints out top of file to a new external file with no modifications a +nd adds new "pool term" to the end of section 2 if ($countsection <= 3){ print COMBINE_FILE "$line\n"; } if ($line =~ /$term)/i) { if ($countsection > 3 && $sepdata[0] eq "+" ) { print COMBINE_FILE "$newterm[1]\n"; } } if ($countsection > 3) { printf COMBINE_FILE "%-3s", $sepdata[0]; printf COMBINE_FILE "%3s ", $sepdata[1]; printf COMBINE_FILE "%-10s", $sepdata[2]; printf COMBINE_FILE "%4s", $sepdata[3]; printf COMBINE_FILE "%5s ", $sepdata[4]; printf COMBINE_FILE "%3s ", $sepdata[5]; printf COMBINE_FILE "$sepdata[6]\n"; } } } }
In reply to trouble matching by cravena
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |