I have a flat file with rows and rows of data, in this file I need to skip most lines, but others I need to extract data from. Below is an example of a line that I need to pull data from and what data I need. Does anyone have an idea of what to match on and how to pull that data?

DATA:

e:\logfiles\beardstownbase.log [3] Thu 22Jun06 08:07:19 - (006415) Sent file d:\data\58bn5904.dat successfully (25.0 Kb/sec - 859216 bytes)

It will look like this every time only the information I need will change other items to key from will remain the same.

I need to key off of the following the .dat & successfully when I find those two on the same line I want to extract the following using a Regex. Other lines Skip.

From example Data I would want to pull:

beardstownbase,Thu 22Jun06 08:07:19,58bn5904,859216 bytes

knowing that each of these feilds will change, but surrounding data will not change. Ideas?

I could see keying off of the //'s and the -' or ('s...


In reply to Regex Help pulling Data from a string by batcater98

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.