Hello everyone - I have a log file which is in the following format:

19476 2013-04-05,12:10:51.909293 host:internal.machine44.company.net main INFO Running normally with ACTION=<processing> FAN_A=<OK> FAN_B=<OK> SEND=<Sent mail (221 2.0.0 Service closing transmission channel)> FAILURE=<2>

What I'd like to do is split this into a few different pieces. The first number is a line number and I do not need it, as well as the host: information. So I'd like to get the data into this format:

$date => 2013-04-05,12:10:51.909293 $info[ACTION] => processing $info[FAN_A] => OK $info[FAN_B] => OK $info[SEND] => Sent mail (221 2.0.0 Service closing transmission chann +el) $info[FAILURE] => 2

I can do this by using performing multiple greps, but can someone show me if there is a more efficient way to read the information in and use the items such as FAN_A and FAN_B as elements for the array and the value inserted from the information between the <>s?

Thanks in advance.


In reply to Some assistance with splitting variables by Anonymous Monk

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.