if (exists $args{dir}) { if(-e $args{dir}) { $directory =$args{dir}; { print "Path: $directory\n\n"; } } else { print "-E- the dir does not exist $args{dir}\n"; exit; } } opendir (DIR , "$directory") || die "Cannot open $directory\n"; chdir($directory); $cmd = "ls -t"; chomp ( @files = grep { /log.sum/} `$cmd` ); #print "@files\n"; $flag_flow = 0 ; $flag_tool = 0 ; print "Script version : v1\n\n"; print "Timestamp Cell Status\t Flow\t\t\t # Errors\t # Warnings\n"; print "========= ====== ====== ====== ========= ==========\n"; foreach (@files) { if(/(\S+)\.(\S+).iss.log.sum/) { $cellname = $1; } @full = "$directory/"."$_"; foreach my $files (@full) { open INFILE , "<$files" ; open OUTPUT , ">>result.txt" ; my @lines = ; my $timestamp = ctime(stat($files)->mtime); my $time = substr($timestamp , 4 , -8); foreach (@lines) { if (/Status\s+Flow/) { $flag_flow = 1; } if($flag_flow) { next if (/====/); if (/^(clean|DIRTY)\s+(\S+)\s+(\S+)\s+(\S+)/) { $data{$a}{Status} = $1; $data{$a}{Flow} = $2; $data{$a}{Errors} = $3; $data{$a}{Warnings} = $4; push @array , $_; #print "$time $cellname $_"; foreach $array (keys %data) { #@summary ="$time\t $cellname $data{$array}{Status}\t $data{$array}{Flow}\t $data{$array}{Errors}\t\t $data{$array}{Warnings}\n"; print "$time\t $cellname $data{$array}{Status}\t $data{$array}{Flow}\t $data{$array}{Errors}\t\t $data{$array}{Warnings}\n"; } } @array = (); } if(/^\s*$/) { $flag_flow = 0 ; } if(/See\s+\$PDSLOGS\/(\S+)\.(\S+)\.icv/) { $error_cellname = $1; $error_flow = $2; #print"$_\n"; #push @match , "cell is $error_cellname , flow is $error_flow\n" ; print "CELL = $error_cellname , FLOW = $error_flow\n"; print "===========================================\n"; $error_count = 1; } elsif(/PLAYERR Files Created/) { $error_count = 0; } elsif($error_count) { #push (@err , $_); print "$_"; } } close INFILE ; } } exit;