This begs for a regular expression. But it's dicey to build a regex based on only one example. Here's a bit of code that you might start with:
my ($date_stamp,$event,$alert_id,$status); my $str = '2001/03/12 time>Event [21]Alert Completed (34562), Status: +[22] Alert Completed,MN_netware-support'; ($date_stamp,$event,$alert_id,$status) = $str =~ /^([\d\/]+).*?(Event.*?ed) \((\d+)\), (.*)$/; print "[$date_stamp]\n"; print "[$event]\n"; print "[$alert_id]\n"; print "[$status]\n";
Which prints out:
[2001/03/12] [Event [21]Alert Completed] [34562] [Status: [22] Alert Completed,MN_netware-support]
This may well break depending on what variation there is in the rest of the data, but it may serve to get you started.
^ start at the beginning of the line ([\d\/]+) match and save a bunch of digits and /'s .*? lazily match and ignore stuff until... (Event.*?ed) match and save of 'Event...ed' match but ignore the following space \( match a literal paren (\d+) match and save a bunch of digits \), match and ignore literal paren, comma, and space (.*) match and save anything until... $ the end of the string

In reply to Re: split delimiters #2 by dvergin
in thread split delimiters #2 by bailybj

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.