J
jesse
I have a master file that gets added to everyday, with backup
failures. The file has server name and what failed. I want to open
the file and read the first line then check the rest of the file for
any more occurrences of that exact failure. Then I want to move to
the second line and repeat the proccess until I have read through the
entire file. When I move down the file I want to ignore lines that
have already been counted. I would also like to be able to ignore
lines if the failure didn't occur the day I am checking for, ie if it
failed today but didn't fail tomorrow then I don't want it to show up
on my report(this is a like to have but it's not mandatory). The file
looks like this;
server2 c:\\
server1 d:\\
server5 e:\\
server1 d:\\
This is the meat of the script that I have that of course is not
working right;
while (<FAILED>){
chomp;
s/#.*//;
next if /^(\s)*$/;
push @failures, $_;
foreach $elem ( @failures ){
next if $seen{$elem}++;
print OUTPUT "$elem has failed $seen{$elem}
times\n";
}
}
failures. The file has server name and what failed. I want to open
the file and read the first line then check the rest of the file for
any more occurrences of that exact failure. Then I want to move to
the second line and repeat the proccess until I have read through the
entire file. When I move down the file I want to ignore lines that
have already been counted. I would also like to be able to ignore
lines if the failure didn't occur the day I am checking for, ie if it
failed today but didn't fail tomorrow then I don't want it to show up
on my report(this is a like to have but it's not mandatory). The file
looks like this;
server2 c:\\
server1 d:\\
server5 e:\\
server1 d:\\
This is the meat of the script that I have that of course is not
working right;
while (<FAILED>){
chomp;
s/#.*//;
next if /^(\s)*$/;
push @failures, $_;
foreach $elem ( @failures ){
next if $seen{$elem}++;
print OUTPUT "$elem has failed $seen{$elem}
times\n";
}
}