So you want the line printed if it does not end in "matches)"? That could be as simple as:
Assuming you've already opened LOG to the right file, and that you're feeding the file to the program on standard input.while (<STDIN>) { # This is backwards, see update below. # next unless /matches\)$/; # print LOG; print LOG unless /matches\)$/; }
Or did I misunderstand your question entirely?
Update
I forgot to mention, there's a bunch of code and information about working with cisco routers in the monastery. Follow that link, or type "cisco" in the search box at the top of the page. You may find your problem solved already.
Update 2
The logic in the original snippet was backwards. Thanks to guha for spotting it.
In reply to Re: Parsing cisco log file
by VSarkiss
in thread Parsing cisco log file
by routedude
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |