Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

grep in Shell script

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 02-19-2008
Krishnaramjis Krishnaramjis is offline
Registered User
 
Join Date: Nov 2007
Last Activity: 11 May 2009, 7:53 PM EDT
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
grep in Shell script

Hello
I do want to write a script which will check any errors say "-error" in the log file then have to send email to the concern person . And the concern person will correct the error .

Next time if the script runs eventhough the error has been corrected it will send the email .

Also one more thing when ever transactions haappened system writes date as well in the log file

How do I write a script ? . I am using

LINE_FOUND=`grep '"error"' /$LOGNAME/logdir/socket.log | grep -v "grep" | grep - "sh -c"


Thanks
Krishna
Sponsored Links
    #2  
Old Unix and Linux 02-19-2008
HPAVC's Unix or Linux Image
HPAVC HPAVC is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 29 October 2009, 8:14 AM EDT
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Krishnaramjis View Post
Also one more thing when ever transactions haappened system writes date as well in the log file

How do I write a script ? . I am using

LINE_FOUND=`grep '"error"' /$LOGNAME/logdir/socket.log | grep -v "grep" | grep - "sh -c"
Can we see a mockup of the the line of the logfile? When I see grep -v grep and grep - it seems like you have been at this too long.
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Grep in Shell script ap2112 Shell Programming and Scripting 5 01-20-2011 10:38 AM
Shell Script with Grep DallasT Shell Programming and Scripting 2 06-02-2010 11:55 AM
How to grep sql error in shell script and exit the script? allinshell99 Shell Programming and Scripting 2 05-27-2010 09:06 PM
Shell script grep help shriyer Shell Programming and Scripting 11 08-03-2009 11:35 AM
Using Grep in a Shell Script nbvcxzdz Shell Programming and Scripting 8 03-19-2005 04:21 AM



All times are GMT -4. The time now is 06:17 PM.