Is awk the solution ?

From: Bruno Misseeuw (brmisseeuw@GE.COKECCE.COM)
Date: Fri Jan 31 2003 - 10:55:17 EST


Hi,

I'm trying to figure out what the best method is to get information out of
a log file (see copy paste below). I believe the awk command to be the
solution, but I'm not sure what the best approach is, as I'm far from an
awk expert. You could say that the lines below represent one record.

1~14907~65537~1043994054(Jan 31 01:20:54 2003)
### EVENT ###
TMW_Clearing;modelname="mySAP_Buffer";profilename="us6db101_DB1_03.mySAP
App Server Performance#us6dem01-region";eventname
="SAP_Buffer_Quality";eventid="1043986250625";event_key
="SAP_Buffer_Quality|sub_origin=us6db101_DB1_03;buffername=PXA;";slotkey
="SAP_Buffer_Quality|sub_origin=us6db101_DB1_03;buffername=PXA;";severity
="HARMLESS";application_class="mySAPAppServer";application_oid
="1473274733.1.1063";application_label
="us6db101_DB1_03";application_version="5.1.0";distrib_admin
="Root_us6dem01-region";hostname="us6db101";origin
="167.105.8.4";adapter_host="us6db101";date="01/31/2003 1:20:49 AM";msg
="The problem described by SAP_Buffer_Quality no longer exists.";END

### END EVENT ###

So my question is to any of those awk guru's out there how would you do
this, or do you recommend another approach ? What I need is the
time/datestamp out of the first line and then a few fields out of the line
which has the ; as a separator. I would then output these fields to a new
file and import the file into excel.

Ideally the output would need to be something like :
Jan 31 01:20:54 2003<TAB>TMW_Clearing<TAB>us6db101<TAB>The problem
described by SAP_Buffer_Quality no longer exists

The date and time comes from line 1. TMW_Clearing is the first field on
the line after ###EVENT###, hostname is ie. field number 10, msg field
number 15...

Best Regards,
Bruno Misseeuw
Coca-Cola Enterprises

*****************************************************************************************************************************************************************************************

This message is intended for the use of the individual or entity to which
it is addressed and may contain information that is confidential and
privileged and exempt from disclosure under applicable law. If the reader
of this message is not the intended recipient, you are hereby notified that
any dissemination, distribution, or copying of this communication is
strictly prohibited. If you have received this communication in error,
please contact the sender immediately and delete it from your system.
Thank you
*****************************************************************************************************************************************************************************************



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:33 EDT