Perhaps this will give you some ideas. Using the following test data:

Something bad happened with orchestral stuff at com.orchestral.rhapsody.execution.route.spi.conditions.ConnectorExe +cutor.accepts(ConnectorExecutor.java:4) and I don't know what to do about this execution failure but execution of orchestral stuff is important

This script:

#!/usr/bin/perl use strict; use warnings; # Create test data, change logic a smidge if reading from monster log +file my @LogBuffer = ( "Something bad happened with orchestral stuff", "at com.orchestral.rhapsody.execution.route.spi.conditions.Connect +orExecutor.accepts(ConnectorExecutor.java:4)", "and I don't know what to do about this execution failure", "but execution of orchestral stuff is important", ); # Convert search strings into regular expressions my @ParseRegExElements = (); foreach my $ParseString (@ARGV) { my $RequestedRegEx = quotemeta $ParseString; push @ParseRegExElements, $RequestedRegEx; } # To check for them only in the order given: print "\n-----[ Must occur in the order given ]-----\n"; { my $ParseRegEx = join '.*', @ParseRegExElements; my @LogMatch = grep /$ParseRegEx/, @LogBuffer; foreach (@LogMatch) { print "Match: [$_]\n"; } } # To check for them in any order: print "\n-----[ May occur in any order ]-----\n"; { my $SearchDirection = (-1); # If == -1: Searching @LogBuffer +into @LogMatch # If == 0: Searching @LogMatch i +nto @NewMatch # If == 1: Searching @NewMatch i +nto @LogMatch my @LogMatch = (); my @NewMatch = (); foreach my $ParseRegEx (@ParseRegExElements) { if ($SearchDirection == (-1) ) { @LogMatch = grep /$ParseRegEx/, @LogBuffer; } elsif ($SearchDirection == 0) { @NewMatch = grep /$ParseRegEx/, @LogMatch; } elsif ($SearchDirection == 1) { @LogMatch = grep /$ParseRegEx/, @NewMatch; } # Toggle Direction $SearchDirection = 1 - abs($SearchDirection); } if ($SearchDirection == 0) { foreach (@LogMatch) { print "Match: [$_]\n"; } } else { foreach (@NewMatch) { print "Match: [$_]\n"; } } } print "\n-----[ Done]-----\n"; exit; __END__

Produced these results:

D:\PerlMonks>parse1.pl orchestral execution -----[ Must occur in the order given ]----- Match: [at com.orchestral.rhapsody.execution.route.spi.conditions.Con +nectorExecutor.accepts(ConnectorExecutor.java:4)] -----[ May occur in any order ]----- Match: [at com.orchestral.rhapsody.execution.route.spi.conditions.Con +nectorExecutor.accepts(ConnectorExecutor.java:4)] Match: [but execution of orchestral stuff is important] -----[ Done]-----


In reply to Re^3: question on log_watcher input by marinersk
in thread question on log_watcher input by adewolf38

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.