The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Accessing variables of one shell script in another shell script rsendhilmani Shell Programming and Scripting 2 03-17-2009 01:17 AM
invoking a shell script inside cgi shell script smriti_shridhar Shell Programming and Scripting 2 07-09-2008 02:50 AM
Accessing variables of one shell script in another shell script looza Shell Programming and Scripting 2 06-30-2008 08:13 PM
To call/execute a shell script from a shell script konark UNIX for Dummies Questions & Answers 1 10-26-2007 06:16 PM
How to pass a parameter from one Shell-script to another Shell-script subodhbansal Shell Programming and Scripting 2 09-22-2007 06:19 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-23-2008
manik007 manik007 is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 1
I need help with a shell script

i am trying to parse the logs from SystemOut.log file and emailing it to my email address ,and i am not able to. Can anyone help me with this....

i tried creating this :
#!/bin/sh
echo " " > /SystemOut.log
for i in 2 3 4 5 6 7 8 9 10
do
shellscript1 -parameter >> /SystemOut.log
sleep 10
done
line=`cat /SystemOut.log | grep 'manik' | wc -l`
echo $line
if [ $line -eq 0 ]
then
echo " "| mail -s "That's the subject" email@email.com
else
cat SystemOut.log | grep 'manik' | mail -s "Did not match the pattern" email@email.com

fi
exit 0



Thank you in advance

edit by bakunin: please post your question to a new thread. Your question and the question of the thread owner have nothing to do with each other.

I am going to split your question to a new thread.

Last edited by bakunin; 09-24-2008 at 07:23 AM..
  #2 (permalink)  
Old 10-09-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,886
Quote:
Originally Posted by manik007 View Post
Code:
cat SystemOut.log | grep 'manik' | mail -s "Did not match the pattern" email@email.com

fi
I think you need cat /SystemOut.log here.
  #3 (permalink)  
Old 10-09-2008
a2156z a2156z is offline
Users Awaiting Email Confirmation
  
 

Join Date: Oct 2008
Posts: 30
why cat then grep, why not grep 'manik' file? which is faster?
grep 'manik' "$file_name" >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
mail -s "no match" ***@***.com
fi
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:20 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0