Re: regex count

2008-09-25 Thread Stephen Reese
> I don't understand why you're /adding/ the match count $x to the hash value > each > time. Is that why you're getting values that you don't expect? > > If the first column of your output is supposed to be a count (for that source > address, connection, or port) then you should be adding one each

Re: regex count

2008-09-25 Thread Rob Dixon
Stephen Reese wrote: > John W. Krahn wrote: >> >> Have a look at the sample data you posted and you will see where. > > I believe I found where the ']' needs to go but didn't see any extra ' ' > space. > > The $x count seems off. As I see it every time a regex match is made then $x > will increas

Re: regex count

2008-09-25 Thread Stephen Reese
> I don't see where you're printing $x to check. Jay, I probably was not and do not know how to :-). > Assuming you have actually checked $x, though, the important question > isn't whether $x == `grep -c regex /your/log/file`. > > The important question is whether $x == scalar keys %srca. > > If

Re: regex count

2008-09-25 Thread Jay Savage
On Wed, Sep 24, 2008 at 10:55 PM, Stephen Reese <[EMAIL PROTECTED]> wrote: >> Have a look at the sample data you posted and you will see where. >> >> >> John > > I believe I found where the ']' needs to go but didn't see any extra ' ' > space. > > The $x count seems off. As I see it every time a re

RE: regex count

2008-09-24 Thread Stephen Reese
> Have a look at the sample data you posted and you will see where. > > > John I believe I found where the ']' needs to go but didn't see any extra ' ' space. The $x count seems off. As I see it every time a regex match is made then $x will increase one. The match numbers results are about 5x g

Re: regex count

2008-09-24 Thread John W. Krahn
Stephen Reese wrote: It appears that there is a space (' ') character at the end of the pattern where there should be a ']' character. John, I'm missing where the closing bracket should go. Have a look at the sample data you posted and you will see where. John -- Perl isn't a toolbox, but a

RE: regex count

2008-09-24 Thread Stephen Reese
> It appears that there is a space (' ') character at the end of the > pattern where there should be a ']' character. John, I'm missing where the closing bracket should go. while () { next unless /Sig:\s*(\d+)\s+Subsig:\s*(\d+)\s+Sev:\s*(\d+)([^\[]+)\[([\d\.]+):(\d+)\s*-> \s*([\d\.]+):(\d

RE: regex count

2008-09-24 Thread Stephen Reese
> I just copied over your code and noticed that the end of > your regular expression (the "/" character) runs across a > newline. Once I moved that back up to this: > > next unless > /Sig:\s*(\d+)\s+Subsig:\s*(\d+)\s+Sev:\s*(\d+)([^\[]+)\[([\d\.]+):(\d+) > \s*->\s*([\d\.]+):(\d+)/; > > $x is incr

Re: regex count

2008-09-23 Thread John W. Krahn
Stephen Reese wrote: Dave wrote: I think the problem might be with your regular expression and not $x. If your regular expression does not match the current line then every line will be skipped. What does the line that is being processed look like? Here are two lines from the log file. S

Re: regex count

2008-09-23 Thread d.tang
I just copied over your code and noticed that the end of your regular expression (the "/" character) runs across a newline. Once I moved that back up to this: next unless /Sig:\s*(\d+)\s+Subsig:\s*(\d+)\s+Sev:\s*(\d+)([^\[]+)\[([\d\.]+):(\d+)\s*->\s*([\d\.]+):(\d+)/; $x is incremented. I won

Re: regex count

2008-09-23 Thread Stephen Reese
> Hello Stephen, > > I think the problem might be with your regular expression and not $x. > > If your regular expression does not match the current line then every line > will be skipped. > > What does the line that is being processed look like? > > Dave Here are two lines from the log file. Sep

RE: regex count

2008-09-23 Thread Dave
Hello Stephen, I think the problem might be with your regular expression and not $x. If your regular expression does not match the current line then every line will be skipped. What does the line that is being processed look like? Dave -Original Message- From: Stephen Reese [mailto:[EM