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. |