Re: Help with arrays



In article <dl0748$b07@xxxxxxxxxxxxxxxxxxxxxx>, Ed Morton wrote:
>
> Try this:
>
> { date = $1
> month = substr(date,1,7)
> host = $8
> hits[month]++
> monthhosts[month,host]++
> }
> END {
> for (month in hits) {
> numHosts = 0
> delete hosts
> for (monthhost in monthhosts) {
> split(monthhost,mhA,SUBSEP)
> host = mhA[2]
> if ((mhA[1] == month) && !(host in hosts)) {
> hosts[host]++
> numHosts++
> }
> }
> printf "%s total number of hits: %d\n", month, hits[month]
> printf "%s unique hosts served: %d\n", month, numHosts
> }
> }
>
> Regards,
>
> Ed.

Thanks, Ed! This gives me a lot to think about.

surf
.



Relevant Pages

  • Re: Eliasberg coins
    ... hits from 1996-1999. ... Regards, ... Tom ... Prev by Date: ...
    (rec.collecting.coins)
  • Resolve of domain name
    ... I have purchased a domain name from www.directi.com now i want to have host ... I have a net connection with Static IP. ... Regards ... Prev by Date: ...
    (microsoft.public.windows.server.dns)
  • gethostname method fails
    ... I am using the following method to get the host name of my computer in an ... I have no clue as to what is happening. ... Best regards, ... Prev by Date: ...
    (microsoft.public.vc.mfc)
  • Re: Eliasberg coins
    ... >hits from 1996-1999. ... Hi Tom - thanks - yes, you are absolutely right, I tried it again also ... Prev by Date: ...
    (rec.collecting.coins)
  • Mad Music Comedy Zone 0097-0100
    ... Host: David Tanny ... This week: The DFSX Time Machine: 1992 ... Anniversary Collection / "Weird Al" Yankovic's Greatest Hits, ...
    (rec.music.dementia)