in reply to Grouping by week
07/16/03 FAILED 07/17/03 PASSED ...and summarizes it by week. It should give you an idea of how to modify your program to do what you want.
#!/usr/bin/perl -w use strict; use Time::Local; my($days,$passed,$firstday,$firstwday); while (<>) { chomp; my($date,$status)=split; my($m,$d,$y) = split(/\//,$date); my($unixtime) = timelocal(0,0,0,$d,$m-1,$y); my(@today)=localtime($unixtime); my $wday = $today[6]; $days++; if ($status eq "PASSED") { $passed++; } if (defined($firstwday)) { if ($wday <= $firstwday) { print $firstday," ",int($passed*100/$days),"\n"; $days=$passed=0; $firstday=$date; $firstwday=$wday; } } else { $firstwday=$wday; $firstday=$date; } } if ($days) { print $firstday," ",int($passed*100/$days),"\n"; }
|
|---|