
Laurent_R
Veteran
/ Moderator
Nov 13, 2012, 10:26 AM
Post #2 of 3
(3658 views)
|
Re: [cspctec] Counting the number of times a sentence occurs
[In reply to]
|
Can't Post
|
|
If you have: User logged in successfully at 10:35:33 User logged in successfully at 10:35:34 User logged in successfully at 10:35:35 and compare the full lines, they will come up as different sentences, because the time stamp is different. So the first thing you need to do is to figure out what part of the sentence is common to all of them. In this case, it would be, for example, "User logged in successfully at ". This means that you have first to process your sentence to keep the common part. Once you have done that, store your sentences in a hash, with the sentence being the key, and the number of occurrence the value. At the end, just scan your hash to prepare your report. The best would be that you show us the script you have written, so that we can point to possible errors and help you correct them.
|