Small Search script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Small Search script
# 1  
Old 06-03-2008
Help in grep and awk

I need to write a small shell script which does the following :

I have a file : root/var/log/ocmp/ocmpclient.log

This is a log file which is continuosly getting updated . I have to keep looking into this file all the time. I have to look for four keywords, "File Detected", File Sending", "File Recieved", "Disconnecting"

Now whenever i find one of these keywords i have to print them on the screen, this process continues till the computer shuts down.

Pls help me, I am supposed to use grep and awk

Help me its urgent.

Last edited by appu1987; 06-03-2008 at 10:12 PM.. Reason: Title modification for quick response
# 2  
Old 06-03-2008
Do not double post.

start with this at boot up:
Code:
tail -f < root/var/log/ocmp/ocmpclient.log | grep -f /path/to/t.sed

t.sed:
Code:
File Detected
File Sending
File Recieved
Disconnecting

# 3  
Old 06-03-2008
path

what path is mentioned after grep should i copy the line as it is and where should t.sed be saved.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

need help with small script

Hi I have the below file Name=abc Yr=2011 Mon=05 My script should be in such a way that whenever I run it then Month should increment by 1 and if the month is 12 then when I run the script then year should incremented by 1 and month Should become 01(I.e jan) Thanks for the help in... (6 Replies)
Discussion started by: kishu
6 Replies

2. Shell Programming and Scripting

What's wrong with this small script?

Hi all, Here is a little script, that - as far as i know - is supposed to print the current active tcp sessions on port 22 (ssh). The first echo command - where i entered the port directly - works fine. In the second case i tried to use a variable, and it doesn't work, it gives no result.... (2 Replies)
Discussion started by: peterk2011
2 Replies

3. Shell Programming and Scripting

Need some help with a small SFTP script

Hi there! Could anyone help me out with a shell script that should.. - sftp myuser@myhost - cd public_html/misc/ - mkdir `date --date='1 day ago' +%Y_%m_%d` - cd `date --date='1 day ago' +%Y_%m_%d` - put /home/localuser/files/*.log - quit Thanks for any help :) (2 Replies)
Discussion started by: JKMlol
2 Replies

4. AIX

Need help in a small script

Hello all, could somebody help..? I have following 6 files (with white spaces in their names) This is file This is file1 This is file2 This is file3 This is file4 This is file5 This is file6 I tried to run the below script, and it did not give me desired ouput.. $ for i in `ls -1` >... (7 Replies)
Discussion started by: gsabarinath
7 Replies

5. Shell Programming and Scripting

need a small script

Hello all, i have a batmail process running on my machine(java process). i just need a script we should detect whether the batchnail is running or not.If not it should restart it. Can anyone assist me on this? (1 Reply)
Discussion started by: Rayzone
1 Replies

6. Shell Programming and Scripting

Need help writing a small script

Hi I am trying to do the following: run a command that looks at a binary file and formats it find the first line that has what I am looking for (there will be multiple) print the name of the file that has it So I am running this but ti's not working ls -ltr *20080612* | while read line... (3 Replies)
Discussion started by: llsmr777
3 Replies

7. Shell Programming and Scripting

small script help

#!/bin/ksh for i in *.log* do ls $i|sed 's/\.log$//g' | while read file do echo "file $file is Running" >> lls.txt echo "***************">> lls.txt done done ------------------------------------------------------------------ the output is : file AdapterCCProvisioningInterface... (9 Replies)
Discussion started by: ali560045
9 Replies

8. Shell Programming and Scripting

small script

Hi, I am new to unix shell scripting. I just want a little script to check the no. of processes are equal to 8, then echo a successful message otherwise echo a unsuccessful message. Please help. Thanks. (3 Replies)
Discussion started by: everurs789
3 Replies

9. Shell Programming and Scripting

small script help

here is a small script: if ; then echo please enter an argument fi if [ "$1" = "tom"; then a=$1 echo $a fi here is my question. if the script name is j.sh and I run it : j.sh from shell prompt: without a parameter: it prints please enter an argument but if I go with . j.sh (current... (1 Reply)
Discussion started by: rkl1
1 Replies

10. Shell Programming and Scripting

Need help in a small script

Hi all, I have a file of the following format - EXPRPT:SCN:1.1706E+10:SEQ_START:121652:SEQ_END:121664:0 ( This file name is variable and changes daily) Now in the same directory I have another set of files of the format - EXPRPT.log.0001.0000121669 Now what I am trying to do is to ... (2 Replies)
Discussion started by: super_duper_guy
2 Replies
Login or Register to Ask a Question