in reply to regex log file too many results
What do you expect to get? What was the code that produced the actual output? It seems unlikely to be the code shown - how were the time stamps etc. generated? What does the log file data actually look like?
Try adding a sample of your actual data to the code below (replace the sample stuff following the __DATA__ line) and see if you can reproduce your problem. If so, reply with a better explanation of the problem. If not, tell us what is different about your situation.
use strict; use warnings; my $get = "Starting"; printf ("My get = $get \n"); foreach (<DATA>) { chomp(); printf ("String = $_ \n") unless($_ !~ /$get/); } __DATA__ Fri Aug 26 05:56:01 BST 2005 INFO: PD/ZVKK Load: Starting. Fri Aug 26 05:56:01 BST 2005 INFO: PD/ZVKK Load: Removing old clienta +cc files. Fri Aug 26 05:56:01 BST 2005 INFO: PD/ZVKK Load: Running the stored p +roc. PL/SQL procedure successfully completed.
Prints:
My get = Starting String = Fri Aug 26 05:56:01 BST 2005 INFO: PD/ZVKK Load: Starting.
|
|---|