I am trying to print out lines from a file into another file based on a couple of patterns. I sort of can do it from the command line using "perl -ne '/START/ .. /END/' INfile", but I am trying to put it into a more user friendly script. Anyway I can't figure out how to do it inside a perl script. Can anyone help me?
@lines = <INFILE>;
print OUTFILE $agent;
print OUTFILE "\n";
print OUTFILE "\n";
# go through each line in the file
foreach $line (@lines)
{
# This is where I am screwed up
$temp = /$agent/ .. /^$/;
print $temp;
# $line =~ /FMULV(.*)/
# print OUTFILE $line;
# print OUTFILE "\n";
}
close (INFILE);
@lines = <INFILE>;
print OUTFILE $agent;
print OUTFILE "\n";
print OUTFILE "\n";
# go through each line in the file
foreach $line (@lines)
{
# This is where I am screwed up
$temp = /$agent/ .. /^$/;
print $temp;
# $line =~ /FMULV(.*)/
# print OUTFILE $line;
# print OUTFILE "\n";
}
close (INFILE);