Hello,
I need your help for a Unix log treatment.
I have a file log of this type:
MEGALOG2.LOG :
Quote:
----- amqrccca.c : 804 --------------------------------------------------------
02/24/04 02:51:54
AMQ7467: The oldest log file required to start queue manager XXXX is
S0000010.LOG.
EXPLANATION:
The log file S0000010.LOG contains the oldest log record required to restart
the queue manager. Log records older than this may be required for media
recovery.
ACTION:
You can move log files older than S0000010.LOG to an archive medium to release
space in the log directory. If you move any of the log files required to
recreate objects from their media images, you will have to restore them to
recreate the objects.
-------------------------------------------------------------------------------
02/24/04 02:53:04
AMQ9002: Channel program started.
The log file S0000010.LOG contains the oldest log record required to recreate
EXPLANATION:bjects from their media images. Any log files prior to this will
Channel program 'XXXX.YYYYYYYY' started.ions.
ACTION:
None.
-------------------------------------------------------------------------------
02/24/04 02:54:19
AMQ9213: A communications error for TCP/IP occurred.
EXPLANATION:
An unexpected error occurred in communications.
ACTION:
ACTION:
Look at previous error messages for channel program 'XXXX.YYYYYYYY' in the
error files to determine the cause of the failure.
---------------------------------- amqrccca.c : 804 --------------------------------------------------------
02/24/04 03:03:04
AMQ9002: Channel program started.
EXPLANATION:
EXPLANATION:ram 'XXXX.YYYYYYYY' ended abnormally.
Channel program 'XXXX.YYYYYYYY' started.
ACTION:
None.
----- amqrccca.c : 804 --------------------------------------------------------
02/24/04 03:33:04
AMQ9002: Channel program started.
EXPLANATION:
An unexpected error occurred in communications.
ACTION:
The return code from the TCP/IP (connect) call was 81 (X'51'). Record these
values and tell the systems administrator
------------------------------------------ amqccita.c : 994 --------------------------------------------------------
02/24/04 03:34:19
AMQ9999: Channel program ended abnormally.
EXPLANATION:
EXPLANATION:
Channel program 'XXXX.YYYYYYYY' ended abnormally.
ACTION:
Look at previous error messages for channel program 'XXXX.YYYYYYYY' in the
error files to determine the cause of the failure.
And I would like to have the same log in this format:
Quote:
02/24/04 02:51:54 AMQ7467: The oldest log file required to start queue manager XXXX is S0000010.LOG.
02/24/04 02:53:04 AMQ9002: Channel program started. The log file S0000010.LOG contains the oldest log record required to recreate
02/24/04 02:54:19 AMQ9213: A communications error for TCP/IP occurred.
02/24/04 03:03:04 AMQ9002: Channel program started.
02/24/04 03:34:19 AMQ9999: Channel program ended abnormally.
In fact, for each entry log, I would just have on a single line: the date, the hour, the ID error and just the first text, I want to delete all text that is behind EXPLANATION
I can put the entire entry log on only one line with this command:
Quote:
sed s/^--*?*-*/CHANGEMENT/ ./errors/MEGALOG2.LOG |awk '{if ($1 != "CHANGEMENT")
{printf $0} else { printf "\n"}}' > analyse.log
But I don't know how to eliminate all which is behind EXPLANATION.
I hope that is clear for you.
Thx for your answers.