learningperl01 has asked for the wisdom of the Perl Monks concerning the following question:
<code> sub edits() { if ( -f and /^Khlog.08$/ ) { foreach ( $File::Find::name ) { open(LOG, "< $File::Find::name") or die "Could not open fi +le $_: $!"; while ( <LOG> ) { my $LINE = $_; if ( $LINE =~ m/002389983/ ) { print "Looking for: 002389983\n Found it in file: +$LINE\n"; if ( $LINE =~ m/29994339499/ ) { print "Looking for: 29994339499\n Found it in +file: $LINE\n"; } else { print "Could not find the second string: 29994 +339499\n"; } } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to search for two strings/regex in one file
by JavaFan (Canon) on Dec 01, 2008 at 21:14 UTC | |
|
Re: How to search for two strings/regex in one file
by kyle (Abbot) on Dec 01, 2008 at 21:23 UTC | |
|
Re: How to search for two strings/regex in one file
by toolic (Bishop) on Dec 01, 2008 at 21:14 UTC | |
|
Re: How to search for two strings/regex in one file
by zentara (Cardinal) on Dec 01, 2008 at 21:17 UTC |