Re: --compare current date file with previous day



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)

.



Relevant Pages

  • Re: Freeware 32bit command line hardware detector?
    ... for the purpose of creating a hardware independent Windows XP Ghost ... or whatever I could compare against) and then the ... script would know which HAL to copy into windows\system32 and then the ...
    (microsoft.public.windowsxp.general)
  • Re: Perl script to mimic uniq
    ... > That is not what Unix uniq does. ... Can I se this script to compare the n columns of a file, ... > I suspect there's more to your original problem than you are telling ...
    (comp.lang.perl)
  • Re: Script to compare LPPs on multiple systems ...
    ... Script to compare LPPs on multiple systems ... ... =head1 SYNOPSIS ...
    (AIX-L)
  • Re: easy comparison of figures
    ... Often I want to compare 1 or 2 of those figures when running an altered code. ... Al figures in this container would not be updated, or changed in any way when running the script again. ... run-parameters in the file names. ...
    (comp.soft-sys.matlab)
  • Re: easy comparison of figures
    ... Often I want to compare 1 or 2 of those figures when running an altered code. ... Al figures in this container would not be updated, or changed in any way when running the script again. ... Iam just wondering if anybody has a easy way of comparing figures (like the gui container I just described) without constantly altering or commenting parts of the script to do so. ... run-parameters in the file names. ...
    (comp.soft-sys.matlab)