The UNIX and Linux Forums  


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
Script to find all the files that contain any of the words present in another file tsanthosh Shell Programming and Scripting 4 05-21-2008 03:29 AM
Segmentation (CoreDump) error !! varungupta UNIX for Advanced & Expert Users 16 04-21-2008 06:16 PM
how to read all the unique words in a text file aditya.ece1985 Shell Programming and Scripting 5 11-30-2007 02:26 AM
Read words from file and create new file using K-shell. bsrajirs Shell Programming and Scripting 4 06-01-2007 01:15 PM
Error closing read file ALTRUNVRSOFLN High Level Programming 1 09-18-2006 12:29 PM

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 03-30-2008
Mujtaba khan Mujtaba khan is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 3
script to Read Error,jbase,voilation,segmentation words from a file

Hi,
i need a script to find words "error,jbase,voilation,segmentation" from a file(verify.txt) and if got any of the above words then send an email and if wont find any then execute the cron job. every time it read file verify.txt it must first clear the previous data in the file .

Kindly Help as this script is very important for me .

Thanks in advance

Mujtaba Khan

Last edited by Mujtaba khan; 03-30-2008 at 10:21 AM.. Reason: want to mention that not so much aware of unix scripting
  #2 (permalink)  
Old 03-30-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
man egrep

hint: egrep '(base voilation|error|segmentation)' file

If your verification tool doesn't really misspell "violation", you will need to spell it correctly, of course. (^:
  #3 (permalink)  
Old 03-30-2008
Mujtaba khan Mujtaba khan is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 3
Need to read "error,voilation" from a text file

Hi,
actually our objective is to execute 2 commands at application level .

1st to verify the application archieve that archieve wont have any error if not then rsyn the archieve files to another location .

Here is the detail scenario for u .

a process name jlogdup (application level) need to be executed and redirected to a text file named logdup.verify.txt and then from this file script need to find below words "JBASE" , "ERROR" , "Segmentation" , "Voilation" if found then do noting else rsync the archieve to other location (DR) on another machine.

regards

Mujtaba Khan
  #4 (permalink)  
Old 03-30-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
How nice of you to tell us this. And you want somebody to write the script for you ...?


Code:
jlogdup >logdup.verify.txt
if ! egrep '(spell|things|correctly)' logdup.verify.txt; then
  rsync
#else
  # echo "$0: found the strings above; we now go 'eek'"
fi

If you don't want the file for other purposes then by all means simply jlogdup | egrep

If it's properly written it might even send its error messages to standard error, not standard output, in which case you obviously need a bit of redirection.
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 11:55 PM.


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