Hello listers, I would like to submit a script I have written and it does work. However I am sure that it can be: a. Shorter b. Faster As you will see it is not very well written. Certainly nothing compared to some of the listers code I have seen here. I am new at perl so here goes. Some of you might recognise the sample a part of a Oracle export log, which it is. Now I am not confident enough to use the unedited log and stripping it with perl(maybe oneday), anyway that has already been done with tools like grep and cut. <Script> #Perl Script to Compare two backup logs and then identify # substantial differences in changed tables. use strict; use warnings;
#Open the newer backup log. open FILE, "C:/tmp/max_grow/max1.log" or die "Cann't open : $!"; while(<FILE>){ chomp; #Input to be divided in two: #Sample of file is - # APPDOCTYPE 43 # APPLAUNCH 16 # APTRANS 1245 # ARCHIVE 0 # ASICUST 24 # ASILINK 5 # ASSETATTRIBUTE 736 # ASSETCLASS 1667 # ASSIGNMENT 60648 # ATTENDANCE 103193 #Divide the input into two groups s/(.*\D)+(.*\d)/$2 $1/; #Pass the two groups to variables my $value1 = $2; my $tblnam1 = $1; #Remove all unnecessary spaces. for ($tblnam1) { s/^\s+//; s/\s*$//;} for ($value1) { s/^\s+//; s/\s*$//;} #Open the older log open FILE2, "C:/tmp/max_grow/max4.log" or die "Cann't open : $!"; while(<FILE2>){ chomp; s/(.*\D)+(.*\d)/$2 $1/; my $value2 = $2; my $tblnam2 = $1; for ($tblnam2) { s/^\s+//; s/\s*$//;} for ($value2) { s/^\s+//; s/\s*$//;} # Compare the two logfiles here. if($tblnam1 eq $tblnam2) { my $diff = $value2 - $value1; if($diff > 1000){ print "$tblnam1 :The difference is $diff\n"; } } } } </End Script> Looking forward to your comments, and learning the right way. Rgds Denham Eva Oracle DBA In UNIX Land On a quiet Night, you can hear the Windows machines reboot. ____________________________________________________________________________________________ DISCLAIMER This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. TFMC, its holding company, and any of its subsidiaries each reserve the right to monitor and manage all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. ____________________________________________________________________________________________ _____________________________________________________________________________________ This e-mail message has been scanned for Viruses and Content and cleared by MailMarshal For more information please visit www.marshalsoftware.com _____________________________________________________________________________________