Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
my $logsIncDate = `date +"%b %d %H"`; my @eigrp = (); open SwitchLogs, $logFile or die "Could not open $logFile: $!"; while (<SwitchLogs>) { chomp; my $line = $_; if($line =~ m/$logsIncDate/ && $line =~ m/SW_MATM-4-MACFLAP_NOTIF/ +){ push(@eigrp, "$line\n"); $sendemail = 1; } }

All I want to do is to match the date/time in a line that contain the specified string. So the above code should catch the below one line:

Nov 25 10:59:13 10.1.162.11/10.1.162.11 1410: Nov 25 16:59:12.724: %SW +_MATM-4-MACFLAP_NOTIF: Host 30ff.0c00.d4be in vlan 162 is flapping be +tween port Fa0/13 and port Fa0/10

In reply to Re^4: Match 2 strings in same line by hmb104
in thread Match 2 strings in same line by hmb104

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-24 04:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found