M
mattjones
Hi,
I've got a small problem....im searching for words in a sentence (from
a log file) then pulling the sentence and putting it in a database. My
problem is that if the word and thus the sentence is no in the log file
- it is missing the log file out altogether and now recording them in
the database.
Is there a way of telling the program to look for these words - and if
they are not there - just skip that pattern (leave the field blank) and
move to the next pattern?
<SNIP>
while (<LOG>) {
if (/FASTSEARCH|conflicting/) {
my @lines = split /\n/; {
foreach my $fast (@lines) {
while (<LOG>) {
if (/elapsed/) {
my @lines = split /\n/; {
foreach my $elapsed2 (@lines) {
So, the script looks for FASTSEARCH and conflicting......if these are
not present i'd like the script to leave the field blank and move to
the next pattern (elapsed).
At the moment my script works but a few of the log files don't contain
FASTSEARCH or conflicting and so are not getting read into the database
(presumably because i am just doing loop after loop and if it doesn't
pick up either of these words it breaks the chain!)
Thanks
Matt (PERL Newbie!)
I've got a small problem....im searching for words in a sentence (from
a log file) then pulling the sentence and putting it in a database. My
problem is that if the word and thus the sentence is no in the log file
- it is missing the log file out altogether and now recording them in
the database.
Is there a way of telling the program to look for these words - and if
they are not there - just skip that pattern (leave the field blank) and
move to the next pattern?
<SNIP>
while (<LOG>) {
if (/FASTSEARCH|conflicting/) {
my @lines = split /\n/; {
foreach my $fast (@lines) {
while (<LOG>) {
if (/elapsed/) {
my @lines = split /\n/; {
foreach my $elapsed2 (@lines) {
So, the script looks for FASTSEARCH and conflicting......if these are
not present i'd like the script to leave the field blank and move to
the next pattern (elapsed).
At the moment my script works but a few of the log files don't contain
FASTSEARCH or conflicting and so are not getting read into the database
(presumably because i am just doing loop after loop and if it doesn't
pick up either of these words it breaks the chain!)
Thanks
Matt (PERL Newbie!)