I am looking for a script to do the following. I have a large log file that contains hundreds of warnings, a lot of which can be ignored. The tool doesn't allow me to suppress it, so I like to parse it out from the log file and isolate just the new messages/warnings, based on an exception file.
I have three files,
- log1.txt - first log file generated by the tool.
- log1.exp which is an exception list file that I will create by cutting and pasting items from log1.txt, that can be exempted/ignored from future log files.
- log2.txt will be the new log file containing all or some of the items in the log1.txt and possibly a bunch of new warnings, the ones that I am after.
%>cat log1.txt (first log file)
Date: Sep 11, 2008 10:30 PM
Tool: Micorsoft SQL Server
The signal "/RAM12/dout<15>" is sourceless and has been removed.
[LEFT]The signal "/RAM22/dout<14>" is sourceless and has been removed.
[LEFT]The signal "/RAM23/dout<13>" is sourceless and has been removed.
[LEFT] [LEFT]The signal "/RAM24/dout<12>" is sourceless and has been removed.
Sourceless block
"U0/blk_generator/valid/has_B/dout0" (SFF) removed.
Sourceless block
"U1/blk_generator/valid/has_B/dout0" (SFF) removed.
Sourceless block
"U2/blk_generator/valid/has_B/dout1" (SFF) removed.
Sourceless block
"U3/blk_generator/valid/has_B/dout1" (SFF) removed.
...
..
and a whole bunch of other messages.
%>cat log2.txt will also display similar text with few changes like the date and any messages that were never found after the first run.
%>cat log1.exp (Exception list manually created using text from log1.txt)
The signal "/RAM12/dout<15>" is sourceless and has been removed.
The signal "/RAM22/dout<14>" is sourceless and has been removed.
The signal "/RAM23/dout<13>" is sourceless and has been removed.
The signal "/RAM24/dout<12>" is sourceless and has been removed.
>cleanScript.pl log2.txt log1.exp
Date: Sep 13, 2008 11:45AM
Tool: Micorsoft SQL Server
Sourceless block
"U0/blk_generator/valid/has_B/dout0" (SFF) removed.
Sourceless block
"U1/blk_generator/valid/has_B/dout0" (SFF) removed.
Sourceless block
"U2/blk_generator/valid/has_B/dout1" (SFF) removed.
Sourceless block
"U3/blk_generator/valid/has_B/dout1" (SFF) removed.
...
..
and a whole bunch of other messages.
[/LEFT]
[/LEFT]
[/LEFT]
[/LEFT]
Any help would be greatly appreciated. Perl or AWk would be great.
Basically the cleanScript.pl script would parse through log2.txt, delete any entries that are listed in log1.exp and write out a new file. Please note that some messages are wrapped between multiple lines, like the "Sourceless blok.." warning.