N
Nene
Hi,
This is a script that opens up a log file and searches for the word
'started' and if it finds the word, it prints it and iterates to the
next log file. But for the servers that didn't start, I want it to
print "didn't start". Please help, thanks.
#!/usr/bin/perl
use diagnostics;
use warnings;
open(SCRATCHPAD,"LOG.txt") or die "can't open $!";
my @uniq = <SCRATCHPAD>;
NODE:
foreach my $stuff ( @uniq ) {
chomp($stuff);
open(STARTUP, "/c\$/$stuff/esp.log") or "die can't open $!";
my @log_file = <STARTUP>;
LINE:
for my $line ( @log_file ) {
next LINE if $line !~ /ESP server (started)./;
my $capture = "$1\n";
print "$stuff => $capture";
close(STARTUP);
close(SCRATCHPAD);
}
}
This is a script that opens up a log file and searches for the word
'started' and if it finds the word, it prints it and iterates to the
next log file. But for the servers that didn't start, I want it to
print "didn't start". Please help, thanks.
#!/usr/bin/perl
use diagnostics;
use warnings;
open(SCRATCHPAD,"LOG.txt") or die "can't open $!";
my @uniq = <SCRATCHPAD>;
NODE:
foreach my $stuff ( @uniq ) {
chomp($stuff);
open(STARTUP, "/c\$/$stuff/esp.log") or "die can't open $!";
my @log_file = <STARTUP>;
LINE:
for my $line ( @log_file ) {
next LINE if $line !~ /ESP server (started)./;
my $capture = "$1\n";
print "$stuff => $capture";
close(STARTUP);
close(SCRATCHPAD);
}
}