#!C:\Perl64\bin\perl
use strict;
use warnings;
my $DFS1= "dfs01.out";
my $DFS2= "dfs02.out";
my $DFS3= "dfs03.out";
my $DFS_Report = "DFS_Report.html";
my ($IN,$OUT);
open ($IN,"<","$DFS1") || die "Can not open $DFS1: $!\n";
open ($OUT,">","$DFS_Report") || die "Can not open $DFS_Report: $!\n";
print $OUT "\n
Stratus V Series DFS Report\n\n";
GetDFSdata($DFS1);
open ($IN,"<","$DFS2") || die "Can not open $DFS2: $!\n";
GetDFSdata($DFS2);
open ($IN,"<","$DFS3") || die "Can not open $DFS3: $!\n";
GetDFSdata($DFS3);
print $OUT "\n\n";
close $OUT;
##############################################################
sub GetDFSdata{
my $report = shift @_;
my @lsl;
my $start=qr{^name:\s+(.*)};
my %Hash;
my @array;
my @indexes;
print $OUT "$report
\n";
#Get the ls -l listing
while(<$IN>){
if(/(^w.*)/){
push @lsl,$1;
}else{
next;
}
}
print $OUT "File Listing
\n";
foreach my $l(@lsl){
my @a = split /\s+/,$l;
print $OUT "$a[5]
\n";
}
#Get the list of file names and indexes
print $OUT "File Name and Index List
\n";
while(<$IN>){
chomp;
next if /^operator/;
next if /^[w|W].*/;
next if /^ls.*/;
next if /^[Files|Directories|Links].*/;
next if /^\d{2}-\d{2}-\d{2}.*/;
next if /^dfs.*/;
if(m/$start/){
$Hash{$1}=\@array;
}elsif(m/^record size:\s+\d+/){
push @array,$_;
}elsif(m/^last record:\s+\d+/){
push @array,$_;
}elsif(m/^data byte count:\s+\d+/){
push @array,$_;
}elsif(m/^\s+index name:\s+(\w.*)/){
push @indexes,$1;
}
foreach my $key(keys %Hash){
print $OUT "File: $key
\n";
print $OUT "\tRecord Size: $Hash{$key}[0]
\n";
print $OUT "\tLast Record: $Hash{$key}[1]
\n";
print $OUT "\tData Byte Count: $Hash{$key}[2]
\n";
my $str = join ',',@indexes;
print $OUT "Index Names: $str\n";
}
}
close $IN;
}