my @low_sec = ("00","01","02","03","04","05","06","07","08","09"); my @high_sec = (10 .. 59); my @seconds = (@low_sec,@high_sec); my $greatest = 0; my $total = 0; foreach my $min ($minute .. $minute+9) { foreach my $sec (@seconds) { my $SMPP_count = int ((split (/\s+/,`cut -d "|" -f 1,10,13 SMSCDR*$date$hour$minute*.log |grep "Submit|GSM" |grep "$hour:$min:$sec" |sort |uniq -c`)) [1]) + int ((split (/\s+/,`cut -d "|" -f 1,10,13 SMSCDR*$date$hour$minute*.log |grep "Submit|SMPP" |grep "$hour:$min:$sec" |sort |uniq -c`)) [1]); if ($SMPP_count > $greatest) { $greatest = $SMPP_count; } $total = $total + $SMPP_count; print "$hour:$min:$sec","= $SMPP_count","\t",$total,$/; } } print $greatest,$/;