Re: Help with arrays
- From: surferelf <surferelf@xxxxxxxxx>
- Date: Fri, 11 Nov 2005 08:32:55 -0600
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
.
- References:
- Help with arrays
- From: surferelf
- Re: Help with arrays
- From: Ed Morton
- Help with arrays
- Prev by Date: Re: Misunderstanding of short script behaviour
- Next by Date: Re: Extract filename from path
- Previous by thread: Re: Help with arrays
- Next by thread: Extract filename from path
- Index(es):
Relevant Pages
|