my $column_separator = ","; my $column_number = "4"; $column_number--; my $str = "APPCRASH."; my $file_in = 'c:\perl\week3\WindowsApplicationEvent.csv'; my $file = 'c:\perl\week3\scan.'.$str.'.txt'; my @strings = ("APPCRASH.","he protected system file.","EMET_DLL Module logged the following event:.","your virus/spyware.","A new process has been created\\..","A service was installed in the system\\..","A scheduled task was created\\..","Logon Type:[\\W]*(3|10).","\\\\Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Run.","service terminated unexpectedly\\..","service was successfully sent a.","service entered the.","service was changed from."); my @found = (); my $count = 0; open (LOGFILE, $file_in); print "Opening Eventfile...\n"; my @lines=; open (OUT, ">>", $file) or die "$!"; foreach my $info (@lines){ ++$count; chomp($info); foreach my $string(@strings) { #print " string-->$string\n\n"; #print "BEFORE \n\n $string \n\n $info \n\n"; #if($info =~ m{^$string$}) #if ($info =~ m/$string/) #print " check --> $check"; #if (grep (m{^$string$}), $info) if ($info =~ m{^$string$}) { #print "AFTER $info \n"; push (@found, "Line # $count -> $info "); print OUT "Line # $count -> $string --> $info \n"; #print "Extractig line $count ...\n"; } } }