Need some help with Perl

Sunner

Elite Member
Oct 9, 1999
11,641
0
76
I have to write a script that can make a quick report of a logfile.
The logfiles include alot of things, but only two things are important, member ID's, and status codes.
Say we have 5 members, 1 .. 5, and 3 status codes, 555 would be successful audit, 911 would be failed audit, and 000 would be unknown error.

I've come as far as to make the script break the log down to a file that contains all the log entry's stripped down to the member id and status code, example:
1 555
2 555
1 000
3 911

etc etc, member id followed by status code.

Now the last part I need to do is break this into a report that can be read even if there are 1000 entrys, something like:
Member 1
74 555's
11 911's
7 000's
Member 2
192 555's

etc etc...
In other words, a quick report of how things are going :)

I havent got all that much time though, and have lots of other stuff to do, so I havent really got enough time to learn the language now.
I'd really appreciate any help anyone could offer with this.

Hope I made some sense in trying to explain.
 

RedRooster

Diamond Member
Sep 14, 2000
6,596
0
76
Do a "split" on each line of the log file, then just check if the first parameter is a 1, 2, or 3 and use a counter for each instance. :)
Email me if you need some help, I don't check this board very often at all.


After thinking, here's an example, sort of:

WHILE (<logfile>)
{
split(' ', $_);
if ($_[0]==1)
counter1++;
if ($_[1]==2)
counter2++;
if ($_[1]==3)
counter3++;
}

You've got the hard part over with, as you've already made the log file.