Hello again monks. Now that I have the right log file to code against, I have come across another issue. I have a log formatted like this:
<13>Nov 15 21:26:00 OamCOMM[365626]: TIMESTAMP=Thu Nov 15 21:26:00 2018 MSGCLS=OAMOPE Title=OAM Create OPERATION Severity=Inform message={username:xxxxxxxx@xxxxxxxxxxxxxxxxxxx; causeDISTINGUISH_NAME=label=x,label=x,;label=x,label=xxxxxxxxxxxxxxx, +label=x,label=xxxx USER_LABEL= ******************* parameters after change =******************* label=xxxxxxxxxxxxx label=xxxxxxxxxxxxxxxxxxxxxxx label=xxxxxxxxxxxxxxxxxxxxxxxxxxxx label=sxxxxxxxxxxxxxxxxxxxxxxxxxxxxx label=xxxxxxxxxxxx ******************* xxxxxxxxxxxx =******************* label=x } Message Id=xxxxxxxx
For troubleshooting purposes I extracted one "chunk" of the log and put it into a text file t.txt. I then crafted t.pl to see if I could get the coding to work without impacting my larger script. Basically, I need to capture everything between "message=" and "Message Id" for this log entry. I am thinking in an array for processing after extraction. I have literally tried 40 different ideas, either my own or found on internet search, and nothing works. Here's my t.pl code I'm trying to make work:
#!/bin/perl use strict; use warnings; use Data::Dumper; my $mlsf = "t.txt"; my @res; open IN, "<", $mlsf or die "IN: $!\n"; while (my $mls = <IN>) { @res = $mls =~ m/^.*message=(.*?)Message Id.*$/gs; } print Dumper (\@res);
When I execute this script, I get:
$VAR1 = [];
Anyone have any ideas?

In reply to Multiple Line Regex Not Working by ImJustAFriend

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.