in reply to RegEx & Approach Question

in your regex $2 is

(size/max/drops/flushes).
You need to escape the parenthesis. try the code after escaping (
if ($line =~ m/\s+Input\s+queue:\s+0\/75\/(.*)\/39\s+\(size\/max\/drop +s\/flushes\); \s+Total\s+output drops:\s+(.*)/) { printf("%-20.20s %-22.22s : $line\n",$file,$currentInterface) if ($1 | +| $2 != 0); }
Note: Since ( I think ) I found some mismatch in No. of spaces from your sample text with the regex, I replaced all spaces with \s+ in the regx.

--VC



There are three sides to any argument.....
your side, my side and the right side.

Replies are listed 'Best First'.
Re^2: RegEx & Approach Question
by ikegami (Patriarch) on Oct 09, 2007 at 14:16 UTC

    It's probably best to avoid hardcoding the other numbers.
    Also, much escaping could be avoided by using an alternate delimiter.

    m{\s+Input\s+queue:\s+\d+/\d+/(\d+)/\d+\s+\(size/max/drops/flushes\); +\s+Total\s+output drops:\s+(\d+)/