use strict; use warnings; my %date_hash = ( "Jan" => "01", "Feb" => "02", "Mar" => "03", "Apr" => "04", "May" => "05", "Jun" => "06", "Aug" => "07", "Sep" => "08", "Oct" => "10", "Nov" => "11", "Dec" => "12" ); while(<DATA>) { #stripoff everything up through "WARNGING" #adjust the date, converting the month to it's numerical. s/.+WARNING ([A-Za-z]{3})/$date_hash{$1}/; # remove, the tags before each IP, and also convert the "/port num +ber" to a "space" "port number" #I'm not sure about that part s/[^:]+:(\d+\.\d+\.\d+\.\d+)\/(\d+)/$1 $2:/g; print; } __DATA__ 6/13/2005 5:59:57 PM 10.1.1.2 WARNING Jun 13 2005 22:00:04: %PIX-4-106 +023: Deny udp src aliens:192.168.1.35/1148 dst dmz:10.10.10.32/1434 b +y access-group "aliens"
produces
06 13 2005 22:00:04: %PIX-4-106023:192.168.1.35 1148:10.10.10.32 1434: + by access-group "aliens"
Close?


holli, /regexed monk/

In reply to Re: Multiple Search and Replaces on one file by holli
in thread Multiple Search and Replaces on one file by monger

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.