The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Enterprise Unix Roundup: The Ghost of Unix Future - Server Watch iBot UNIX and Linux RSS News 0 12-19-2007 12:20 PM
Running UNIX commands remotely in Windows box from Unix box – avoid entering password D.kalpana UNIX for Dummies Questions & Answers 1 04-20-2007 06:24 AM
FTP script for sending a file from one unix directory to another unix server director raja_1234 Shell Programming and Scripting 1 11-30-2006 07:57 AM
Unix Sco Open Server, Windows Computers Problem Access Unix Shared Files Help!!!!! haggo Filesystems, Disks and Memory 2 08-23-2006 12:39 PM
Unix History Question: Why are filenames/dirnames case sentsitive in Unix? deckard UNIX for Dummies Questions & Answers 3 03-26-2005 01:59 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 03-02-2004
farzolito farzolito is offline
Registered User
  
 

Join Date: Nov 2001
Location: Lille, France
Posts: 20
Unix log treatment

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.
 

Bookmarks

Tags
regex, regular expressions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:34 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0