05-07-2009
Is there a better way to grep until end of error message?
My file creates an output log after which includes a few sql queries.
I segregate them into warnings and errors and then get a total count.
The errors' and warnings' lines always start with SQL[0-9]{4}[A-Z] followed by the details of the error.
This is what im doing as o now...
errors=`grep -A 1 -E "^SQL3196N|^SQL3147N|^SQL3148W" $output.log`
This gets me only the first line after a match is obtained.
Some errors have 1 line and others stretch out to 10 lines...
How would do you capture this info for errors and warnings and later on count the number of distinct errors and warnings encountered???
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hi,
I get this error message after I pipe a lot of output into grep. Does anyone know what his means?
grep: writing output: Invalid argument
thanks,
gammaman (3 Replies)
Discussion started by: gammaman
3 Replies
2. Shell Programming and Scripting
I need some tips to write a unix korn shell script that will parse an input text file. Input text file has messages that span several lines, each field in the message is delimited by /034 and the end of message is delimited by /035.
Input file looks something similar to
... (1 Reply)
Discussion started by: indianya
1 Replies
3. Shell Programming and Scripting
I have a script which will take two file as the inputs and take the Value in file1 and search in file2 and give the output in Outputfile.
#!/bin/sh
#. ${HOME}/crossworlds/bin/CWSharedEnv.sh
FILE1=$1
FILE2=$2
for Var in $(cat $FILE1);do
echo $Var
grep -i "$Var" $FILE2
done > Outputfile
I... (2 Replies)
Discussion started by: SwapnaNaidu
2 Replies
4. Shell Programming and Scripting
Hello,
I'm writing a script that will automate the launch of some services on my AIX machine. However, some services are dependent on the successful startup of others. When I start these services manually, I usually just check a log file until I see a message that confirms a successful... (3 Replies)
Discussion started by: pallak7
3 Replies
5. Shell Programming and Scripting
My file creates an output log after which includes a few sql queries.
I segregate them into warnings and errors and then get a total count.
The errors' and warnings' lines always start with SQL{4} followed by the details of the error.
This is what im doing as o now...
errors=`grep -A 1 -E... (11 Replies)
Discussion started by: VGR
11 Replies
6. Shell Programming and Scripting
Hi All,
Please tell me how to append some text message at the end of the file.
"File too large to view"
example: xyz.log contains
hhhhhhhhhhh
hhhhhhjjjjjjjjj
jjjjjjjjjjjjjjjjjjjjjj
"File too large to view"
Please advice (3 Replies)
Discussion started by: rajeshorpu
3 Replies
7. Shell Programming and Scripting
Hi i'm new to the forum and was hoping someone could help me with the following query.
I do alot of testing and have hundreds of log files output. I have a script (someone else wrote) which finds all the passed and failed logs and puts a number in a column onto a webpage:
e.g:
Pass ... (4 Replies)
Discussion started by: defamer
4 Replies
8. Shell Programming and Scripting
I have prepare script to grep for outofmemory messages in the logs. I need help in modifying script. I have implemented small logic. The outofmemory messages form six logs will store in variables.
var1=`grep -i outofmemory $tomcat1logs | sed -n '$p'| sed -n -e "s/.*\(outofmemory\).*/\1/p"`... (6 Replies)
Discussion started by: coolguyamy
6 Replies
9. Shell Programming and Scripting
Hi
I am not able to grep a message in a log file -
For ex - Notice < > "Server1" is in deploying state under "Stut" domain
When i use gzcat logfile | grep -i " Notice < > "Server1" is in deploying state under "Stut" domain"
It is not returning any value.
Is it because of "Server1"... (1 Reply)
Discussion started by: honey26
1 Replies
10. Shell Programming and Scripting
I have ASCII files to parse that 48 hours old or more ; I can identify them like so
find . -name "FILE*TXT" -mtime +1 -exec ls -ltas '{}' ';'
Some files have a list of hardware errors (we test electronic components), some have none. If the file name has no errors, I still want to... (3 Replies)
Discussion started by: alan
3 Replies
ZGREP(1) General Commands Manual ZGREP(1)
NAME
zgrep - search possibly compressed files for a regular expression
SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename...
DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code:
(-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the
standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep.
If the GREP environment variable is set, zgrep uses it as the grep program to be invoked.
EXIT CODE
2 - An option that is not supported was specified.
AUTHOR
Charles Levert (charles@comm.polymtl.ca)
SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1)
ZGREP(1)