Perl - extracting lines?

  • Thread starter Thread starter Doctor_mizo
  • Start date Start date
D

Doctor_mizo

Guest
Hello all
I have this code
use File::Tail;
$|++;
$name="C:\users\Mizo\desktop\log.txt";
$file=File::Tail->new(name=>$name, maxinterval=>1,interval=>1, adjustafter=>1);
while (defined($line=$file->read)) {
if ($line=~/rules.txt/i){
print "$line";
}
}

Log.txt has this

Host:xXMizoXx
Request:blabla
Method:GET
Http:HTTP/1.1

I want the previous code match the rules.txt with only the "Request" in the log file .. and ignore the others
do you know how to make it happens?
 
Back
Top