At the line:  if($_ =~ m/ORA-/ ){ 

a) you don't need the m/ just / 
b) what are you expecting to be in $_ and have you checked (print stderr
"$_";)?


Kind regards,

Mark Anderson
SMS Deployment
The Royal Bank of Scotland
113 Dundas Street, Edinburgh, EH3 5DE
http://www.manufacturing.rbs.co.uk/GTrswi/


> -----Original Message-----
> From: Denham Eva [SMTP:[EMAIL PROTECTED]
> Sent: Friday, August 20, 2004 11:30 AM
> To:   Perl-Win32-Users@listserv.ActiveState.com; beginners@perl.org
> Subject:      Pls Help with a Basic Script.
> 
> *** WARNING : This message originates from the Internet ***
> 
> 
> 
> Please could the wise folks give me some help. Something is wrong and I
> can not find out what.
> 
> When I run this program it returns everything is OK (Suspect a logic error
> somewhere), which is not possible as the logs in question do have data
> that I require (i.e. ORA-12571: TNS:packet writer failure).
> 
> This script is to check the Oracle Logs for errors beginning with "ORA-"
> i.e. ORA-013100
> 
> Then it should return only the errors. You will see I try to reverse the
> file as I only want the newest errors first, anyway I want to build that
> functionality into it eventually that I can set a limit...but that is for
> later.
> 
> Here is my script.
> 
>  
> 
> ****************************** SNIP ***********************************
> 
>  
> 
> #!/usr/bin/perl -w
> 
> use strict;
> 
> use warnings;
> 
> # use POSIX 'strftime';
> 
> # For later functionality.
> 
> # my $day = (strftime('%w', localtime()) - 1);
> 
>  
> 
> # Save all the sites to be checked in a text file
> 
> # Example line:-
> 
> # OrcaleSid:://windowsserver/share/directory/logfile.log
> 
>  
> 
> open SITES, "c:/denham/dba/sites/alrtlogs.txt" || die "Can not Open
> alrtlogs.txt: $!";
> 
>  
> 
> # Now while through the file and do each site.
> 
> while (<SITES>) {
> 
>     (my $sid, my $loc) = split(/::/);
> 
>     chomp($sid);
> 
>     chomp($loc);
> 
>     
> 
>     print "~~~~~~~~~~~~~~~~~~~~~~~~\n";
> 
>     print "~~ Checking $sid ~~\n";
> 
>     print "~~~~~~~~~~~~~~~~~~~~~~~~\n";
> 
>  
> 
> # open the LogFile    
> 
>     open SITELOG, "$loc" ||die "Can not open $loc: $!";
> 
>  
> 
> # I suspect that my mistake may be around here :-)
> 
> # Check the file for any ORA- entries    
> 
>     if($_ =~ m/ORA-/) {
> 
>         # If it contains records, reverse the file
> 
>         my @lines = reverse($_);
> 
>         my $rownum = 0;
> 
>         
> 
>             # Starting from the last line look for the error
> 
>         for my $line($lines[$rownum]) {
> 
>             if ($lines[$rownum] =~ m/ORA-/) {
> 
>                 print "$lines[$rownum]\n";
> 
>             }
> 
>         $rownum = $rownum + 1;
> 
>         }
> 
>     }else{
> 
>         print "Nothing to Report\n";
> 
>     }
> 
>     close SITELOG;
> 
> }
> 
> *************************************** SNIP
> COMPLETE******************************
> 
>  
> 
> Many Thanks
> 
> Denham
>  << File: ATT3333781.txt >> 


The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB

The Royal Bank of Scotland plc is authorised and regulated by the Financial 
Services Authority and represents The Royal Bank of Scotland Marketing Group. 
The Bank sells life policies, collective investment schemes and pension 
products and advises only on the Marketing Group's range of these products and 
on a With-Profit Bond produced by Norwich Union Life (RBS) Limited.

This e-mail message is confidential and for use by the addressee only. If the 
message is received by anyone other than the addressee, please return the 
message to the sender by replying to it and then delete the message from your 
computer. Internet e-mails are not necessarily secure. The Royal Bank of 
Scotland plc does not accept responsibility for changes made to this message 
after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of viruses, 
it is the responsibility of the recipient to ensure that the onward 
transmission, opening or use of this message and any attachments will not 
adversely affect its systems or data. No responsibility is accepted by The 
Royal Bank of Scotland plc in this regard and the recipient should carry out 
such virus and other checks as it considers appropriate.

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to