Enlightened ones,
I'm a perl beginner and have a need to write a script that takes the output from a cisco router that looks like this:
permit ip 7.0.0.0 0.255.255.255 10.31.224.0 0.0.3.255 (55164 matches)
permit ip 8.159.0.0 0.0.255.255 any (4908356 matches)
permit ip any host 10.202.11.250
permit tcp any 172.16.96.200 0.0.0.7 established (10421619 matches)
permit udp any host 172.16.68.225 eq tftp (8 matches)

I need to look at each line and if it doesn't have matches log the line to a file. I was thinking I could split the array by spaces and look at the last $line[] but the last $line[] (greping "matches on it) would be variable. Therein lies my question. Sorry if it's a simple one but I'm quite stuck.
If you're interested in what I'm trying to do here: This access-list is quite (outrageously) long and nobody has kept up on removing unneeded lines. This script will eventually check each line for matches for a period of time and remove any lines that do not generate matches after said period of time.
Thanks in Advance!

edited: Sun Mar 9 14:38:05 2003 by jeffa - title change (was: Perl n00b help)


In reply to Parsing cisco log file by routedude

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.