searching using grep command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting searching using grep command
# 8  
Old 12-15-2008
Hi,

i am oracle dba and one my duty is to watch this logfile (alert_pindb.log) and oracle errors are start with ORA- error and it will be in this file if something went wrong,

as of now due to some problem ORA-00600 is frequently coming and i am working on that to overcome but apart from this ora-00600 error if any error come i should be notified and this is done by perl script and scheduled in cronjobs for every 30 minutes
$cd11 = "cd /oracle/admin/pindb/bdump";
$cd1 = "grep -v \"ORA-00600\" alert_pindb.log | grep \"ORA-\" alert_pindb.log | wc -l";
$telnet1 -> cmd ($cd11);
@test1 = $telnet1 -> cmd ($cd1);
@arr1 = split(" ",$test1[0]);
$desc =$arr1[0];

if($desc>0)
{
print "SMS Sent";
$text="ORA- error in 172.16.1.13 Server. Plz chk immediately.";

thanks

prakash
# 9  
Old 12-15-2008
Hi,
this will give you erroneous output. you will be counting all instances of ORA- including ORA-00600. try appending a line with ORA-00600 in your logfile and run this command.

--

i have only one instance in this server

Thanks

Prakash
# 10  
Old 12-15-2008
I didnt mean the instance of your db in the box. What i meant is the occurences of ORA- in your logfile. In your modified script, as I said it will count all the occurences of ORA- including your supposedly excluded line(ORA-00600). To check try copying your logfile and append a line or lines that contains the string ORA-00600. Run your command with that file and you will see that it will count the line ORA-00600.

Hope to clear things up. Thanks!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Searching for exact match using grep

I am searching for an exact match on a value read from another file to lookup an email address in another file. The file being checked is called "contacts" and it has Act #, email address, and contact person. 1693;abc1693@yahoo.comt;Tommy D 6423;abc6423@yahoo.comt;Jim Doran... (2 Replies)
Discussion started by: ziggy6
2 Replies

2. Shell Programming and Scripting

Searching for multiple patters using grep

i have a file as below grepfile.txt ---------------- RNTO command successful No such file or directory Authentication failed if i seach individually for 'RNTO command successful' or 'No such file or directory' using grep -i as below, im gettting result. grep -i 'No such file or... (5 Replies)
Discussion started by: JSKOBS
5 Replies

3. UNIX for Dummies Questions & Answers

Grep - Searching for multiple items using one command

I am performing a regular check on UNIX servers which involves logging onto UNIX servers and using the grep command to check if a GID exists in the /etc/group directory e.g. grep 12345 /etc/group I have five to check on each server, is there anyway I can incorporate them into one command and... (2 Replies)
Discussion started by: @MeDaveT
2 Replies

4. Shell Programming and Scripting

dynamic string searching for grep

hi my code is something like count=0 echo "oracle TABLESPACE NAME nd TARGET" while do count=`expr $count + 1` (1) tts_space_name$count=`echo $tts | cut -d "," -f$count` (2) target$count=grep $(tts_space_name$count)... (2 Replies)
Discussion started by: Gl@)!aTor
2 Replies

5. Shell Programming and Scripting

grep searching interval

Hi all, I just want to find all values that are in a specified interval. I tryed it with grep e- file , it does not work. Is it possible to get values wich are lower a special number, like grep >e-18 file? Thanks a lot (4 Replies)
Discussion started by: newcommer
4 Replies

6. Shell Programming and Scripting

grep searching

I am making a script but having little problem. at one part I need to find one number format or other format from a file.. those formats are xxx-xx-xxxx or xxxxxxxxx i tried grep '( \{3\}-\{2\}-\{3\} |\{9\})' if i do them sepratly it work but like this it is not working Please check... (7 Replies)
Discussion started by: Learnerabc
7 Replies

7. Shell Programming and Scripting

can anyone help with shell script command about searching word with grep command?

i want to search in the current directory all the files that contain one word for example "hello" i want to achieve it with the grep command but not with the grep * (2 Replies)
Discussion started by: aintour
2 Replies

8. UNIX for Dummies Questions & Answers

Searching mutiple word - Tuning grep command

Hi all, I have a log file which is more than 1GB, i need to take count from the log file for two strings. i am using the below command but it take a long time to excetue, i need to tune this. Please help me cat /logs/gcbs/gcbsTrace.log | grep -i "ViewStatementBusinessLogic" | grep -c -i... (8 Replies)
Discussion started by: senthilkumar_ak
8 Replies

9. Shell Programming and Scripting

GREP Searching for a newbie...

Hi, I really need some help with GREP searching... I need to find all occurances of a file reference and remove two characters from the end of the reference. For example, here are a few lines showing the text: <image file="STRAIGHT_004CR.jpg" ALT="STRAIGHT_004CR.jpg" /> <image... (8 Replies)
Discussion started by: steveglevin
8 Replies

10. Shell Programming and Scripting

grep - searching for a specific string

ppl, this is my "file" with fields orderno orderdate orderdesc telno street city 1 01/04/2006 abc 123 100 tampa 2 01/04/2006 abc 123 100 tampa 3 01/04/2006 abc 123 100 tampa 4 01/04/2006 abc ... (2 Replies)
Discussion started by: manthasirisha
2 Replies
Login or Register to Ask a Question