This is a oneliner that removes the AIX TIMESTAMP, and prepends the date:

$ errpt |perl -lape '@_=$F[1]=~/(..)/g; substr $_,11,11,""; $_ = ($.== +1? "TIMEDATE".(" "x8) : "20".join("-",@_[4,0,1])." ".join(":",@_[2,3] +))." ".$_' TIMEDATE IDENTIFIER T C RESOURCE_NAME DESCRIPTION TIMEDATE IDENTIFIER T C RESOURCE_NAME DESCRIPTION 2013-09-30 15:27 982C78BF T S mir0 DISPLAY ADAPTER CONFIGUR +ATION ERROR 2013-09-25 16:27 BA431EB7 P S SRC SOFTWARE PROGRAM ERROR

You can also replace the TIMESTAMP with the TIMEDATE:

errpt | perl -lape '@_=$F[1]=~/(..)/g; substr $_,11,11, ($.==1? "TIMED +ATE".(" "x9) : "20".join("-",@_[4,0,1])." ".join(":",@_[2,3])." ")' IDENTIFIER TIMEDATE T C RESOURCE_NAME DESCRIPTION 982C78BF 2013-09-30 15:27 T S mir0 DISPLAY ADAPTER CONFIGUR +ATION ERROR BA431EB7 2013-09-25 16:27 P S SRC SOFTWARE PROGRAM ERROR

for the following errpt output:

IDENTIFIER TIMESTAMP T C RESOURCE_NAME DESCRIPTION 982C78BF 0930152713 T S mir0 DISPLAY ADAPTER CONFIGURATION +ERROR BA431EB7 0925162713 P S SRC SOFTWARE PROGRAM ERROR
</code>

Note that AIX errpt output does not have the seconds, so you can add those as hardcoded :00

Should you not have a header in the output you want parsed, then remove the $.==1? "TIMEDATE".(" "x9) :

Sorry for necroposting.


In reply to Re: Parsing bizarro AIX errpt timestamps into English (or SQL DATETIME) format. by FreeBeerReekingMonk
in thread Parsing bizarro AIX errpt timestamps into English (or SQL DATETIME) format. by bpoag

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.