[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [multitail] regex help

Laurent TAUPIAC wrote:

>> Alternative:
>>     multitail -em "(\d\.\d\.108\.226|\d\.\d\.108\.226|^\[.+\] \[\S\] )"
>> but I think what you really want is the context option in GNU's grep (i.e. -A or
>> --after-context=NUM), to match the line with the IP address and show the next
>> line... I don't see that option in multitail.  You can ask for a new feature.
> Generic line (i mean line not assigned to IP) are not always folling
> something. The 3 line of sample is not ordered. So next line that
> following the matching one is not a valid solution for me.


> I try your alternative,  some remarks
> - \d\.\d\.108\.226 will match but not, you should wrote \d+\.\d+\.108\.226

I don't agree, \d matches any sequence of digits, it's just short notation for
[0-9]+ .

> - You had set twice 108.226 but this should be mistype.

Yes, my mistake.

> - the \d char classes doesn't work for me in multiltail, but [0-9] do.
> - ^\[.+\] \[\S\] will not match anything unless the second brackets pair hold only one no space char such  [a], should put [\S+] to match more stuff, anyway, even corrected, this regexp will match all line since all line start with the format '[date] [level] ', that's why i appended the negative look ahead assertion in my example. eg: start(?!\[) => match start if not followed by \[
> - As for \d, \S is not working in my myltitail. 
> Could someone confirm that standard base character classes for regexp
> work or not in multitail  ?
> List of base character classes i know
> classes <=> equivalent
> \w <=> [a-zA-Z0-9_]
> \W <=> [^a-zA-Z0-9_]
> \s <=> [ \t\n\r]
> \S <=> [^ \t\n\r]
> \d <=> [0-9]
> \D <=> [^0-9]
> I have compiled multitail 4.2.0 on SunOS 5.9 Generic_112233-08 sun4u
> sparc SUNW,Sun-Blade-1000

René Berber