#!/opt/perl5/bin/perl -w use strict; my $Number; my $ln=@ARGV; if($ln<1 or $ln>1){ die "A single Store number is required!\n"; }else{ $Number=sprintf("%03d",$ARGV[0]); } ## Setup the Search Date ## my ($day,$month,$year)=(localtime(time-60*60*(12+(localtime)[2])))[3,4 +,5]; $day=sprintf"%02d",$day; $month=sprintf"%02d",$month+1; $year=sprintf"%04d",$year+1900; my $Date="$month/$day/$year"; my $RegDate=qr/$month\/$day\/$year/o; ## Setup and precompile the errorcodes ## my $err1=qr/Disconnected/o; my $err2=qr/sopup\.sh/o; my $err3=qr/switch_sh\.sh/o; my $err4=qr/Node/o; my $err5=qr/^NetBIOS/o; my $err6=qr/Manual/o; my $err7=qr/Beginning/o; my $err8=qr/^AUP rejecting duplicate transaction/o; my $err9=qr/LAN/o; my @Messages=qw($err1 $err2 $err3 $err4 $err5 $err6 $err7 $err8 $err9) +; $/="------------------------------------------------------------------ +---------- --\n"; my $File="Unity$Number.log"; my $RPT=substr($File,0,8); my $Filepath="/HOST/INDATA/stlog/$File"; my $Rptpath="/HOST/INDATA/stlog/$RPT"; open(FH,"$Filepath")||die"Can't open $File: $!\n"; my (%hash,$count); $count=1; while(<FH>){ chomp; my @array=split /\n/; foreach my $msg(@Messages){ if($array[0]=~/^Number/){}else{ if($array[6]=~$msg & $array[1]=~$RegDate){ my $ref=\@array; $hash{$count}=$ref; $count++; } } }## END OF FOREACH STATEMENT ## }## END OF WHILE STATEMENT ## close FH; open(RPT,">$Rptpath")||die"Can't open $RPT: $!\n"; print RPT "Report Date: $Date\n"; print RPT "$RPT\n"; print RPT "============================\n"; foreach my $key(keys %hash){ for(0..6){ print RPT "$hash{$key}[$_]\n"; } print RPT $/; } close RPT;
In reply to Re: Loading a HoH
by TStanley
in thread Loading a HoH
by TStanley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |