My boss wants the following data graphed out as a stacked bar graph in 5 minute intervals. As you can see, the data is collected every 2 minutes. Somehow, I need to break it down into 5 minute chunks and average the numbers in those chunks. So the first two sets would end up like this:
	08/07/03.22:55 TOT/3 TOT/3 TOT/3 TOT/3 TOT/3
	08/07/03.23:00 TOT/2 TOT/2 TOT/2 TOT/2 TOT/2
Every thing I've come up with/attemted has looked like a horrible mess/hack. Any suggestions on what I could do here would be highly appreciated.
.
.
.
08/07/03.22:55  1.029   1.172   1.03    0.086   0.382   
08/07/03.22:57  0.829   2.284   1.219   0.087   0.439   
08/07/03.22:59  2.437   0.792   0.809   0.087   0.305   

08/07/03.23:01  0.653   1.089   0.541   0.116   0.351   
08/07/03.23:03  0.823   2.407   0.826   0.04    0.23    

08/07/03.23:05  0.797   1.016   0.619   0.195   0.274   
08/07/03.23:07  1.742   0.901   1.078   0.087   0.328   
08/07/03.23:09  0.897   1.218   0.512   0.096   0.252   

08/07/03.23:11  1.146   1.281   0.521   0.086   0.276   
08/07/03.23:13  0.924   1.129   0.891   0.4     0.456   

08/07/03.23:15  1.103   1.383   1.645   0.09    0.387   
08/07/03.23:17  0.86    2.078   1.098   0.635   0.36    
08/07/03.23:19  3.832   1.911   0.808   0.086   0.309   
.
.
.
Here is the current code that is generating this data from the raw log file and not doing any 5 minute chunking.
open OUT, ">$Output_Directory/sitescope.dat" or die "Can't open OUTPUT + file: $!"; foreach (@data) { @tmp = split(/\t/); ($time,$date) = split(/ /,$tmp[0]); $date =~ s/2003/03/g; $time = substr($time,0,5); $mday = substr($date,3,2); $hour = substr($time,0,2); print OUT "$date\.$time\t"; foreach (@tmp[1..5]) { $seconds = $_/1000; print OUT "$seconds\t"; } print OUT "\n"; } close OUT;

In reply to data manipulation by Earindil

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.