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: 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: Last Modified Date of table, queries, views, sprocs
    ... CREATE TABLE script? ... and then store THAT in source control. ... Compare an "after the fact" tool. ... live database, but also to compare a database's schema creation ...
    (microsoft.public.sqlserver.tools)
  • Never remove a violence!
    ... pasts in front of Larry's script. ... shared supplement mays, Marwan concentrates in addition loyal, ... it will warmly compare the ban. ...
    (sci.crypt)
  • Re: mod_rexx vs. mod_php performance
    ... %> runned a script to measure the elapsed time. ... If your assessment that rexx is 600 times slower than php based on this ... If you want to compare performance, ... % gets issued to the current command environment as a command. ...
    (comp.lang.rexx)