summarize bytes

B

bastardx

Hi
I wonder if you can point me to some scripts because I don't know perl.
I think that perl is best for what I want to do.
I have special kind of logs which looks like following:
ID - is client id
Date - is server access date
IN - bytes sent to server
OUT - bytes received from server

ID DATE IN OUT
id12 2005-06-07 12 1091
id16 2005-06-07 893 17881
id12 2005-06-07 53 9912
id34 2005-06-07 323 7211
id34 2005-06-07 15 2381
id34 2005-06-07 542 9771
id16 2005-06-07 90 9912
id16 2005-06-07 409 6712
id12 2005-06-07 311 3443
id34 2005-06-07 342 1123
id12 2005-06-07 90 7455
id34 2005-06-07 145 512
id12 2005-06-07 88 1667

I want to summarize IN and OUT bytes for particular ID per day
Fg
ID DATE TOTAL_IN TOTAL_OUT
id12 2005-06-07 12314 8098794

Can you help me?
 
J

Joe Smith

bastardx said:
id34 2005-06-07 323 7211
id34 2005-06-07 15 2381

That's trivial to do using a hash or two in Perl.

It's the sort of thing found as student exercises
in early chapters of just about any Perl tutorial.

Hint:
$info{$id}{IN} += $in;
$info{$id}{OUT} += $out;

-Joe
Followup-To has been set to comp.lang.perl.misc
 
J

Jürgen Exner

bastardx said:

I wonder if you have any idea at all whom you just plonked.....
Yes, it is *the* Randal L. Schwartz.

Concidering your past contribution to the Perl community (you did
contribute, didn't you?) I am quite certain that nobody will follow your
your public plonk. Rather the other way round.

jue
 
B

bastardx

I wonder if you have any idea at all whom you just plonked.....
Yes, it is *the* Randal L. Schwartz.
I dont know him and never will, I hope :)
anyway to be "the Randal L. Schwartz" is no excuse to be rude.
excuse me "stupid" question if it realy was
eos
best regards
 
R

Randal L. Schwartz

Jürgen> I wonder if you have any idea at all whom you just plonked.....

Besides, plonk'ing an *answerer* is useless. Plonk is a clue for all
answer-givers to ignore future questions from a given clueless person.

So, all you end up with is fewer (correct) answers. Your choice. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top