script to Read Error,jbase,voilation,segmentation words from a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script to Read Error,jbase,voilation,segmentation words from a file
# 1  
Old 03-30-2008
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 KhanSmilie

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  
Old 03-30-2008
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  
Old 03-30-2008
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  
Old 03-30-2008
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell - Read a text file with two words and extract data

hi I made this simple script to extract data and pretty much is a list and would like to extract data of two words separated by commas and I would like to make a new text file that would list these extracted data into a list and each in a new line. Example that worked for me with text file... (5 Replies)
Discussion started by: dandaryll
5 Replies

2. Shell Programming and Scripting

Shell script to read words into an array

Hello, I have output like below: ----------------------------------------------------------------------------- Group 'group1' on system 'system01' is running. ----------------------------------------------------------------------------- Group 'group2' on system 'system01' is running.... (4 Replies)
Discussion started by: sniper57
4 Replies

3. Shell Programming and Scripting

'Couldn't read file' error in bash script with expect, sed and awk!

Ok, so I have a bash script with an embedded expect statement. Inside of the expect statement, i'm trying to pull all of the non-comment lines from the /etc/oratab file one at a time. Here's my command: cat /etc/oratab |sed /^s*#/d\ | awk 'NR==1'|awk -F: '{print \"$1\"}'|. oraenv Now,... (0 Replies)
Discussion started by: alexdglover
0 Replies

4. Shell Programming and Scripting

Splitting Concatenated Words in Input File with Words from a Master File

Hello, I have a complex problem. I have a file in which words have been joined together: Theboy ranslowly I want to be able to correctly split the words using a lookup file in which all the words occur: the boy ran slowly slow put child ly The lookup file which is meant for look up... (21 Replies)
Discussion started by: gimley
21 Replies

5. Shell Programming and Scripting

Shell script to find out words, replace them and count words

hello, i 'd like your help about a bash script which: 1. finds inside the html file (it is attached with my post) the code number of the Latest Stable Kernel, 2.finds the link which leads to the download location of the Latest Stable Kernel version, (the right link should lead to the file... (3 Replies)
Discussion started by: alex83
3 Replies

6. Programming

fscanf: read words from file

Hi I have a file like that: 1 2 3 4 5 6 7 8 and I want print on stdout: 1 3 8 in other words i want choose what print out. I was thinking to use fscanf as: fscanf(file_in,"%d %d %d",&a, &b,&c); but in this way i get: 1 2 3 Is there a solution using fscanf to obtain my... (2 Replies)
Discussion started by: Dedalus
2 Replies

7. Shell Programming and Scripting

To read and separate number and words in file and store to two new file using shell

hi, I am a begginer in unix and i want to know how to open a file and read it and separate the numbers & words and storing it in separate files, Using shell scripting. Please help me out for this. Regards S.Kamakshi (2 Replies)
Discussion started by: kamakshi s
2 Replies

8. Shell Programming and Scripting

how to read all the unique words in a text file

How can i read all the unique words in a file, i used - cat comment_file.txt | /usr/xpg6/bin/tr -sc 'A-Za-z' '/012' and cat comment_file.txt | /usr/xpg6/bin/tr -sdc 'A-Za-z' '/012' but they didnt worked..... (5 Replies)
Discussion started by: aditya.ece1985
5 Replies

9. Shell Programming and Scripting

Read words from file and create new file using K-shell.

Hi All, Please help me in creating files through K-shell scripts. I am having one file in this format. OWNER.TABLE_NAME OWNER.TABLE_NAME1 OWNER1.TABLE_NAME OWNER1.TABLE_NAME1 I want to read the above file and create new file through k shell script. The new file should looks like this.... (4 Replies)
Discussion started by: bsrajirs
4 Replies
Login or Register to Ask a Question