Having worked with a lot of fixed-length data (Fortran output), I've done it like this:
#!/usr/bin/perl use strict; use warnings; <DATA>; <DATA>; # skip header lines while (<DATA>) { my @fields = / (.{51}) (.{21}) (.{21}) (.{21}) (.+) /x or next; my @fields_nospace = map {/^\s*(.+?)\s*$/; $1} @fields; print join ("\t", @fields_nospace), "\n"; } __DATA__ (your data here)
Output:
N-20070143.003.TXT 05/23/07 02:36:59 PM 13 13 0 N-20070143.004.TXT 05/23/07 04:48:56 PM 1 1 0 N-20070143.006.TXT 05/23/07 04:48:56 PM 16 16 0 N-20070143.008.TXT 05/23/07 04:48:58 PM 19 19 0 N-20070143.009.TXT 05/23/07 04:48:59 PM 1 1 0 N-20070143.010.TXT 05/23/07 04:49:00 PM 5 4 1 N-20070143.012.TXT 05/23/07 04:49:00 PM 18 18 0 N-20070143.013.TXT 05/23/07 04:49:02 PM 20 20 0 N-20070143.015.TXT 05/23/07 04:49:03 PM 53 53 0 N-20070143.011.TXT 05/24/07 04:35:48 PM 5 5 0 N-20070152.040.TXT 06/18/07 04:03:26 PM 25 21 4

In reply to Re: How to monitor a logfile with columns for certain data? by gamache
in thread How to monitor a logfile with columns for certain data? by freddiel

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.