checking ERRors in files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting checking ERRors in files
# 1  
Old 01-07-2008
checking ERRors in files

I m having trouble in a script.I need To write a script that will check for Following Errors in Logs Files,i.e files having Extension .log

The erros are

2008-01-01 15:19:11,822 [main] ERROR - ORA-01115: IO error reading block from file 51 (block # 717090)
ORA-01110: data file 51: '/ednpdtu1/u01/oradata/EDNAMIP/indx_l_2_04.dbf'
ORA-27091: skgfqio: unable to queue I/O
ORA-27072: skgfdisp: I/O error

Can U Help me out in this................There are some 80 logs files and I need to check the above error in all those 80 log files
# 2  
Old 01-07-2008
i have the script as :

#!/bin/ksh

if test -f lerr1.txt
then
rm lerr1.txt
fi

for i in file1,file2,file 3........................file 80
do
echo $i >>lerr1.txt
grep "ORA" >> lerr1.txt
done

mail -s "ORA error in log files" naveed@unix.com< lerr1.txt
----------------------------------------------------------------------

is there any way instead of writting 80 files name in for loop i can just give *.log and it will check in all the log files for "ORA" pattern and also send me the file name where this pattern is found.............
# 3  
Old 01-07-2008
Java

Code:
for i in *.log
do
    grep ORA "$i" >>lerr1.txt
done

or

Code:
grep ORA *.log >>lerr1.txt

# 4  
Old 01-07-2008
i have done this script but its getting stuck in ist file only.can u tell me wats the wrong in it

if test -f lerr1.txt
then
rm lerr1.txt
fi

for i in *.log
do
echo "processing for $i"
echo $i >> lerr1.txt

grep ERROR >> lerr1.txt
echo "Process Finished for $i:"
done
# 5  
Old 06-19-2008
Quote:
Originally Posted by ali560045
i have done this script but its getting stuck in ist file only.can u tell me wats the wrong in it
this will work Smilie

if test -f lerr1.txt
then
rm lerr1.txt
fi

for i in *.log
do
echo "processing for $i"
echo $i >> lerr1.txt
grep ERROR $i >> lerr1.txt
echo "Process Finished for $i"
done

lg
wizo_de
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Errors trying to use all files of a type

I am trying to create a code that will use all the bam files stored on a separate drive (/media/cmccabe/C2F8EFBFF8EFAFB9/pool_I_090215), run them in a program that I have changed the directory to, and the output gets re-directed to (/home/cmccabe/Desktop/NGS/pool_I_090215). I have tried the... (11 Replies)
Discussion started by: cmccabe
11 Replies

2. AIX

I see some errors in syslog files in AIX. can these be ignored ?

Hello, Could you please check the below errors. I found these errors in AIX LPAR syslogs. auth|security:err|error sshd error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key daemon:err|error syslog: slp: 0660-059 Impossible to get local interface for distant address 10.x.x.x. errno... (2 Replies)
Discussion started by: Kumar7997
2 Replies

3. Programming

Linker errors linking to .a files on OS X

Basically my problem is that when I try to compile anything using ./configure && make, it fails because of linker errors. I can reproduce the behavior I'm getting as follows: I have the two following files main.c: #include <stdio.h> extern void func(void); int main(int argc, char... (5 Replies)
Discussion started by: MarshallBanana
5 Replies

4. Shell Programming and Scripting

Checking in a directory how many files are present and basing on that merge all the files

Hi, My requirement is,there is a directory location like: :camp/current/ In this location there can be different flat files that are generated in a single day with same header and the data will be different, differentiated by timestamp, so i need to verify how many files are generated... (10 Replies)
Discussion started by: srikanth_sagi
10 Replies

5. UNIX for Dummies Questions & Answers

Need help in checking for files in subfolders

Hi, I am trying to print a listing of files from the top level directory, check to see if any files have the same name as the top level directory name and if so, cd to that file and list the files under it. Don't know how to check for the file in the next level. What I have so far: ... (6 Replies)
Discussion started by: tes218
6 Replies

6. Ubuntu

Errors while extracting zip files

I tried to untar a file, test123.tar.gz by doing : tar -zxvf test123.tar.gz but got the following error msg: gzip: stdin: not in gzip format tar: Child returned status 1 tar: Exiting with failure status due to previous errors What do i do now? Pl Suggest Thanks (3 Replies)
Discussion started by: DCH
3 Replies

7. UNIX for Dummies Questions & Answers

Checking files extension

Hi, I need one line command to display all files that ends with .scr. Example: In a directory I have 10 files, out of that 4 files have filetype extension .dat and 4 files with .scr and 2 files with .txt.... In this i want to display only files that ends with .scr. I tried some commands,... (2 Replies)
Discussion started by: gwgreen1
2 Replies

8. UNIX for Advanced & Expert Users

how to login into another ip and checking for the files

Hi All, Good Day. need one help regarding unix script. i have to check whether the particular file is there or not in another ip address. suppose....there is file in this ip address 2.160.64.130 in particualar location. i have to veify this from another ip adress(Say 2.160.64.131).if the file... (1 Reply)
Discussion started by: saikumar_n
1 Replies

9. UNIX for Dummies Questions & Answers

checking for files on ftp...

I have automated my ftp session as given in on of the previous threads as: #! /usr/bin/ksh HOST=remote.host.name USER=whoever PASSWD=whatever exec 4>&1 ftp -nv >&4 2>&4 |& print -p open $HOST print -p user $USER $PASSWD print -p cd directory print -p binary print -p get xyz wait... (3 Replies)
Discussion started by: jithinravi
3 Replies

10. Shell Programming and Scripting

checking for script errors

ok, i have a script which i use to search my process' for specific keywords and kill any process containing them. there is a prompt to enter a keyword for searching and another prompt for which user you want to search the process' of. i want the script to have something that if you entered a search... (1 Reply)
Discussion started by: Blip
1 Replies
Login or Register to Ask a Question