Parse out known messages from a log file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Parse out known messages from a log file
# 8  
Old 10-02-2008
Yes, that is weird. This is what I get with uname.

Code:
%>uname -a 
Linux zh0tx.xyz.com 2.6.9-67.EL.bz439580.16smp #1 SMP Fri Jul 25 03:21:36 EDT 2008 i686 i686 i386 GNU/Linux

I think a perl script that would open exception list, take each line and then parse through the "orig" and remove matching entries is what we need.
# 9  
Old 10-02-2008
Code:
(12:39:29\[ddecosta@S.Man)
[~]$ uname -a
SunOS king 5.10 SunOS_Development sun4u sparc SUNW,Sun-Fire-V890

pdt:/home/pdt --> uname -a
Linux showrunner 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:30:39 EST 2005 i686 i686 i386 GNU/Linux

pdt:/home/pdt --> egrep --v
egrep (GNU grep) 2.5.1

I'm sure a perl script would work...but it just seems like a canon on a mosquito. I may just be bitter because I never made it past the hello world stage of learning perl though...
# 10  
Old 10-02-2008
I got someone else to try it and it worked for them. So I tried on that exact same machine, but, no, it wouldn't do it for me. So then the only difference that I can see is that they are using CSH whereas I am running tcsh. I wonder if that has anythign to do with it.
Code:
egrep --v
egrep (GNU grep) 2.5.1

Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Now that we are both using the same version of egrep, the only other diff I see is that I have more patches on my machine than both you and the other person who got it working. May be it is the patch that is messing it up. Hmmmm... I would be surprised if a patch mess up a program like grep!!
# 11  
Old 10-02-2008
PHP Code:
#!/bin/perl -w

################################
use strict;

open FILE1,    '< ignorelist.txt' or die $!;
open OUTFILE,  '>>clean_report.txt' or die $!;

while (<
FILE1>)
{
  
$FILE1hash{$_}=1;
}
close(<FILE1>);


open FILE2,    '< new_report.txt' or die $!;

while (<
FILE2>)
{
  print 
OUTFILE $_ unless defined($FILE1hash{$_});
}

close FILE2;
close OUTFILE
I got a small perl script almost working. But seeing some errors... don't know what yet!
# 12  
Old 10-02-2008
Work's for me:
Code:
$ grep -vf filter file
Date: Sep 11, 2008 10:30 PM
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.
$ grep --v
grep (GNU grep) 2.5.1-FreeBSD

Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ echo $SHELL
/bin/tcsh

# 13  
Old 10-02-2008
I have no idea what's going on with my system. It just wouldn't do it... strange indeed.. the only thing I can think of is the Linux patch level..
Quote:
Linux zh0tx.xyz.com 2.6.9-67.EL.bz439580.16smp #1 SMP Fri Jul 25 03:21:36 EDT 2008 i686 i686 i386 GNU/Linux
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Parse apache log file with three different time formats

Hi, I want to parse below file and Write a function to extract the logs between two given timestamp. Apache (Unix) Log Samples - MonitorWare The challenge here is there are three date and time format. First :- 07/Mar/2004:16:05:49 Second :- Sun Mar 7 16:02:00 2004 Third :- 29-Mar... (6 Replies)
Discussion started by: sahil_shine
6 Replies

2. Shell Programming and Scripting

Shell Script | Parse log file after a given date and time stamp

I am developing one script which will take log file name, output file name, date, hour and minute as an argument and based on these inputs, the script will scan and capture all the error(s) that have been triggered from a given time. Example: script should capture all the error after 13:50 on Jan... (2 Replies)
Discussion started by: ROMA3
2 Replies

3. Shell Programming and Scripting

Parse log file to insert into database

I have a log file that's created daily by this command: sar -u 300 288 >> /var/log/usage/$(date "+%Y-%m-%d")_$(hostname)_cpu.log It that contains data like this: Linux 3.16.0-4-amd64 (myhostname) 08/15/2015 _x86_64_ (1 CPU) 11:34:17 PM CPU %user %nice ... (12 Replies)
Discussion started by: unplugme71
12 Replies

4. Shell Programming and Scripting

Parse A Log File

Hello All, Below is the excerpt from my Informatica log file which has 4 blocks of lines (starting with WRITER_1_*_1). Like these my log file will have multiple blocks of same pattern. WRITER_1_*_1> WRT_8161 TARGET BASED COMMIT POINT Thu May 08 09:33:21 2014... (13 Replies)
Discussion started by: Ariean
13 Replies

5. Shell Programming and Scripting

Check/Parse log file's lines using time difference/timestamp

I was looking at this script which outputs the two lines which differs less than one sec. #!/usr/bin/perl -w use strict; use warnings; use Time::Local; use constant SEC_MILIC => 1000; my $file='infile'; ## Open for reading argument file. open my $fh, "<", $file or die "Cannot... (1 Reply)
Discussion started by: cele_82
1 Replies

6. Shell Programming and Scripting

Sed to parse log file

Hi all, thanks for reading the post. I'm trying to parse hundreds of log files in a directory. One log file looks similar to below: Investigator : Jim_Foo Custodian : Jim_Foo-HDD1-FOO-1234 Export Path : N:\FOO-1234\Foo_Foo Compute MD5 : No File List Only: No Extensions Selected:... (4 Replies)
Discussion started by: chipperuga
4 Replies

7. Shell Programming and Scripting

Parse the log file

./abc.sh started at Sun Oct 24 06:42:04 PDT 2010 Message: ======= Summary Report of NAME count ----------------------------------------------------------------- Below is the output of the SQL query :- NAME COUNT... (2 Replies)
Discussion started by: sandy1028
2 Replies

8. Shell Programming and Scripting

parse a log file and remember last line

Hi all: I'm working on a HPUX 11.23 system and I am needing to parse a tomcat-jakarta log file for memory use. Getting the desired data is easy, assuming the log file does not grow. This file grows constantly and I want to check it q 5 min. The next check will pick up from where it left off 5... (4 Replies)
Discussion started by: raggmopp
4 Replies

9. Shell Programming and Scripting

Help w/ script to read file and parse log message

Hi, I am working on the script to parsing the specific message like "aaaa" in multiple log files like N1-***,N2-***,N3-***... The script is to find the list of lof files which contains the message "aaaa" and export the list into excel filE. Can anyone give help? Thanks (2 Replies)
Discussion started by: shyork2001
2 Replies

10. Shell Programming and Scripting

Piping tail to awk to parse a log file

Hello all, I've got what I'm pretty sure is a simple problem, but I just can't seem to work past it. I'm trying to use awk to pretty up a log file, and calculate a percentage. The log file looks like this: # tail strtovrUsage 20090531-18:15:45 RSreq - 24, RSsuc - 24, RSrun - 78, RSerr -... (4 Replies)
Discussion started by: DeCoTwc
4 Replies
Login or Register to Ask a Question