[BNM] best way to count a query string
David Stone
dave at builtbydave.co.uk
Thu Mar 2 14:13:44 GMT 2006
Hows your bash scripting? If your going over the logs I'd have a look at
the man pages for awk, sort, and uniq, could do something like:
cat access_log |awk '{ print $7}'|awk -F'&' '{ print $1}'|sort|uniq -c
cat access_log |awk '{ print $7}'|awk -F'&' '{ print $2}'|sort|uniq -c
D
--
David Stone
w: http://www.builtbydave.co.uk/
t: 07908 257349
Josh Russell wrote:
> hello,
>
> this is a slightly abstract question, and the answer will be limited
> some by the technology and expertise available to me, but here
> goes.......
>
>
> i have a url, for examples sake:
>
> http://www.mydomain.com/index.htm?query1=aaaa&query2=wwww
>
> this url changes frequently e.g.
>
> http://www.mydomain.com/index.htm?query1=aaaa&query2=wwww
> http://www.mydomain.com/index.htm?query1=aaaa&query2=xxxx
> http://www.mydomain.com/index.htm?query1=aaaa&query2=yyyy
> http://www.mydomain.com/index.htm?query1=aaaa&query2=zzzz
>
> or even:
>
> http://www.mydomain.com/index.htm?query1=aaaa&query2=wwww
> http://www.mydomain.com/index.htm?query1=bbbb&query2=wwww
> http://www.mydomain.com/index.htm?query1=cccc&query2=wwww
> http://www.mydomain.com/index.htm?query1=dddd&query2=wwww
>
> but not so often.
>
> now my question is, how can i record and count all the different
> strings that may appear for query2? e.g.
>
> 1. wwww
> 2. xxxx
> 3. yyyy
> 4. zzzz
>
> and then how many times each one appears too..
>
> i guess this could be done in logs somehow, but there are potentially
> millions of different strings..
>
>
> any ideas greatly appreciated!
>
>
> cheers
>
> josh
>
>
>
>
> --
> Josh Russell
> www.joshrussell.com
> www.comicrelief.com
> www.makepovertyhistory.org
> www.metranet.co.uk
>
> get some web hosting!
> http://tinyurl.com/zvblf
>
More information about the BNMList mailing list
BNMList is hosted by Screenlists, a Screen-Play.net service