#!/usr/local/bin/perl use Data::Dumper; use strict; # filename like wspmon03.DSKAvgServ.log my $filename = $ARGV[0]; (my $hostname, my $parameter) = split("\.", $filename, 2); open(FDAT, $filename) || die "Can't open file: $filename - $!\n"; my $count = 0; my $inst = ""; my $previous_inst = "dummy"; while() { if (/.*\/DISK\.(.*)\/.*/) { my $inst = $1; } else { if ($previous_inst ne $inst) { $count = 0; $previous_inst = $inst; } (my $dayofweek, my $month, my $date, my $timing, my $year, my $dpoint) = split(); my %host ( $inst, $count => { 'dayofweek' => $dayofweek, 'month' => $month, 'date' => $date, 'timing' => $timing, 'year' => $year, 'dpoint' => $dpoint } ); $count=$count+1; } } print Dumper(%host); close (FDAT);