On Apr 3, 8:06 am, Mag Gam wrote:
> Thanks for the responses.
>
> Basically, I have a large file with this format,
>
> Date INFO username command srcipaddress filename
>
> I would like to do statistics on:
> total number of usernames and who they are
> username and commands
> username and filename
Thanks for the responses.
Basically, I have a large file with this format,
Date INFO username command srcipaddress filename
I would like to do statistics on:
total number of usernames and who they are
username and commands
username and filenames
unique source ip addresses
unique filenames
The
On Sat, Apr 2, 2011 at 5:24 PM, Chris Angelico wrote:
> On Sun, Apr 3, 2011 at 9:58 AM, Mag Gam wrote:
> > I suppose I can do something like this.
> > (pseudocode)
> >
> > d={}
> > try:
> > d[key]+=1
> > except KeyError:
> > d[key]=1
> >
> >
> > I was wondering if there is a pythonic way of do
On Sun, Apr 3, 2011 at 9:58 AM, Mag Gam wrote:
> I suppose I can do something like this.
> (pseudocode)
>
> d={}
> try:
> d[key]+=1
> except KeyError:
> d[key]=1
>
>
> I was wondering if there is a pythonic way of doing this? I plan on
> doing this many times for various files. Would the python
I have a file like this,
cat file
aaa
bbb
aaa
aaa
aaa
awk '{x[$1]++}END { for (i in x) {print i,x[i]} } ' test
bbb 1
aaa 4
I suppose I can do something like this.
(pseudocode)
d={}
try:
d[key]+=1
except KeyError:
d[key]=1
I was wondering if there is a pythonic way of doing this? I plan on