Re: --compare current date file with previous day
- From: "Shahriar" <rahman77@xxxxxxxxx>
- Date: 27 Sep 2006 10:24:16 -0700
Hi David,
Thank for your input. So far I am trying with your script:
use Date::Manip;
use Tie::File;
my %log;
$log{$_}= sprintf("/usr/bin/%s/*.rpt",UnixDate($_,'%m-%d-%y')) for
qw{today yesterday};
print "TODAY $log{'today'} \n";
print "YesterDAY $log{'yesterday'} \n";
tie @today, 'Tie::File', $log{'today'} or die "Can't open the file";
tie @yesterday, 'Tie::File', $log{'yesterday'} or die "Can't open the
file";
if ($today[2] eq $yesterday[2])
{
print "Both same\n";
}
else
{
print "diff result\n";
}
I need more help from you. The report file generates in each folder (by
date) has this format: Report_0925.rpt (So each date's report file is
different by name).
In each *.rpt file the log is written something like that:
PASS (p) 10
FAIL (-) 1
How I can compare the FAIL lines value to get a difference to generate
email? My script: I don't think its comparing.
Your help is appreciated.
Thanks,
Shahriar
usenet@xxxxxxxxxxxxxxx wrote:
Shahriar wrote:
URGENT HELP NEEDED
You reduce your chances of getting help when you shout how important it
is. It's really urgent only to you.
/home/usr/09-26-06/log1.rpt and I need to compare with the previous
day: /home/usr/09-25-06/log1.rpt.... some thing like that.
use Date::Manip;
my %log;
$log{$_} = sprintf("/home/usr/%s/log1.rpt",
UnixDate($_,'%m-%d-%y')
) for qw{today yesterday};
Now open and read $log{'today'} and compare line 2 with
$log{'yesterday'}. You may prefer to use Tie::File to simplify this.
I need to compare the second line.
You may be able to get by with a straight eq operation.
perldoc perlop
To be on the safe side, parse out the value with a regular expresion:
perldoc perlre
If the no. of FAIL changes then it
will send email automatically to the users.
use Mail::Sendmail; #or one of the many other mail modules
--
David Filmer (http://DavidFilmer.com)
.
- Follow-Ups:
- Re: --compare current date file with previous day
- From: usenet
- Re: --compare current date file with previous day
- Prev by Date: Re: bad magic
- Next by Date: Re: can you pass an array in a form in Perl
- Previous by thread: can you pass an array in a form in Perl
- Next by thread: Re: --compare current date file with previous day
- Index(es):
Relevant Pages
|
|