in reply to Re: Find a pattern
in thread Find a pattern
All,
Thanks a lot
My requirement is such that if the log contains the string
like "2 failed" or "3 failed"..."<any number except 0>" failed.
I have some other processing to do. So will the below code work.
my $file = "D:/perl/02.log"; open my $inFile, '<', $file or die "cant open $file: $!"; # Look for errors while (<$inFile>) { if (/\d{1-9} failed/) { print "There are build errors (see line $.)\n"; exit 0; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Find a pattern
by GrandFather (Saint) on Jan 28, 2011 at 11:13 UTC | |
|
Re^3: Find a pattern
by jethro (Monsignor) on Jan 28, 2011 at 10:25 UTC |