codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  how to aggregate the hourly  mukkavilli at 05:56 on Thursday, September 15, 2005
 

Hi how to get the hourly aggregation on the time
ex :
20050823 14:12:00
20050823 14:12:01
20050823 14:12:11
20050823 14:12:12
20050823 14:12:13
20050823 14:12:47
20050823 14:12:48
20050823 14:13:05
20050823 14:13:16
20050823 14:13:25
20050823 14:13:30
20050823 14:13:31
20050823 14:13:31
20050823 14:13:32
20050823 14:13:32
20050823 14:13:33
20050823 14:13:33
20050823 14:13:34
20050823 14:13:34
20050823 14:13:34
20050823 14:13:36
20050823 14:13:47
20050823 14:14:02
If this is the in an array
How can i get the hourly i.e 14 i have to trace the all urls at 14 hr and also should have the number of hits in a
single with hr 20050823 14:00:00 like
20050823 14:12:00,www.pdablast.com ,1
20050823 14:12:01,www.pdablast.com ,2
20050823 14:12:11,www.pdablast.com ,3
20050823 14:12:12,www.pdablast.com ,4
20050823 14:12:13,www.pdablast.com ,5
20050823 14:12:47,www.pdablast.com ,6
20050823 14:12:48,www.pdablast.com ,7
20050823 14:13:05,www.pdablast.com ,8
20050823 14:13:16,www.pdablast.com ,9
20050823 14:13:25,www.pdablast.com ,10
20050823 14:13:30,www.pdablast.com ,11
20050823 14:13:31,www.pdablast.com ,12
20050823 14:13:31,www.pdablast.com ,13
20050823 14:13:32,www.pdablast.com ,14
20050823 14:13:32,www.pdablast.com ,15
20050823 14:13:33,www.pdablast.com ,16
20050823 14:13:33,www.pdablast.com ,17
20050823 14:13:34,www.pdablast.com ,18
20050823 14:13:34,www.pdablast.com ,19
20050823 14:13:34,www.pdablast.com ,20
20050823 14:13:36,www.pdablast.com ,21
20050823 14:13:47,www.pdablast.com ,22



it should be displayed like
20050823 14:00:00,www.pdablast.com,hits:22
so could you please help me out to sort out the date by h

  Re: how to aggregate the hourly  javabits at 21:07 on Friday, September 16, 2005
 

Here's a snippet that parses out all the fields from each log entry. Reads from a file. Should be simple enough to make it group values as you need. You'll probably want to use an associative array to store values until you get to the next hour.

#!/usr/bin/perl

open (FILE, "$ARGV[0]");

while (<FILE>)
{
$_ =~ /([0-9]{8}) ([0-9]{2}):.+?,(.+?) ,(.+?)/gso;
$date = $1;
$hour = $2;
$url = $3;
$hits = $4;

print "$date $hour:00:00,$url,hits:$hits\n"
} # While <FILE>

close(FILE);








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Why Use Method?
•  Re: Help with filesystem object & displaying in a table
•  Re: Genetic Algorithm Help
•  Re: How to make an investment calculator
•  Re: line breaks in GUI
•  Re: Graph in Gui...
•  Graph in Gui...
•  Re: Counting zero values in a string
•  Re: Help!


Recent Articles
Multiple submit buttons with form validation
Understanding Hibernate ORM for Java/J2EE
HTTP screen-scraping and caching
a javascript calculator
A simple way to JTable
Java Native Interface (JNI)
Parsing Dynamic Layouts
MagicGrid
Caching With ASP.Net
Creating CSS Buttons


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005