Shell stop process after found value in file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell stop process after found value in file
# 1  
Old 02-25-2008
Shell stop process after found value in file

hi guys can somebody help me here...

i've a file that contains total of ip that connects to my server and their ip like this :

80 80 xxx.xxx.xx.xxx
75 75 xxx.xxx.xx.xxx
73 73 xxx.xxx.xx.xxx

where first columns and second were the total connections...

What i wanna do is i want to grep that ip and do a nslookup to find the server name. I've success to do that with this code:

cat ${FILE} |
while read NO TOTAL IP ; do
LOOKUP_RES=$(nslookup $IP | sed -n 's/.*arpa.*name = \(.*\)/\1/p')
test -z "$LOOKUP_RES" && LOOKUP_RES="Failed"
echo -e "$TOTAL\t$IP\t$LOOKUP_RES"

done >> ${REPORT}

my problem is how can make my script to stop process and doesn't to read all the remaining line when it found total ip that connect was below 50?

can somebody help please Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to stop debug in the mid of process?

Hi Gurus, I am debugging a script. it loops filelist. since the list a very long. when debugging, I only can see the last a few lines. is there any way to stop debuger in the mid of process. the command I used for debugging is: ksh -x scriptName Thanks in advance (7 Replies)
Discussion started by: ken6503
7 Replies

2. Shell Programming and Scripting

How to stop the process in shell scripting?

Hi all, I have tried the below code to execute. #! /bin/bash date1=`date -d "today 08:00:00" +%s` date2=`date -d "today 08:01:00" +%s` path=/home/user01/red/IDC/sample cd $path java Cspsamp 111.19.5.172 7025 rd1 rd1 "5022=Query|5026=109378|4=627|5=E:VD|5042=$date1|5049=$date2"... (5 Replies)
Discussion started by: aish11
5 Replies

3. UNIX for Dummies Questions & Answers

Stop the process

I have the following log file running since yesterday and its consuming so much of the disk space. -rw-rw-r-- 1 dev dba 4543237120 Nov 10 09:00 load_run_file1_0.1111091224.lg How do i kill this process. I don't have any idea of stopping this. Any help would be really appreciated. ... (3 Replies)
Discussion started by: bobby1015
3 Replies

4. Shell Programming and Scripting

Process running? Stop it

I have this "process keepalive" script: #!/bin/bash PIDFILE=/tmp/php.pid PHPSCRIPT=/home/www/mydomain.com/subdomains/www/parser.php echo 'Checking php process from PID file' if ; then PID=`cat $PIDFILE` if ps ax | grep -v grep | grep $PID > /dev/null then echo "php process still... (4 Replies)
Discussion started by: LukasB
4 Replies

5. Shell Programming and Scripting

Stop load script if error found...

Hi all, Is there any command in Unix, which will stop the load process if any error is found in the i/p file? I am trying to load 5 files sequentially. A then B then C then D then E end; 1) If A encounter's any error while data load, the load process should stop, and it should not... (5 Replies)
Discussion started by: msrahman
5 Replies

6. Shell Programming and Scripting

Start/Stop process when a file is modified.

I have a file which is modified via a web application & this may happen during any time of the day/week. This file is being used a config/list file for another shell script which runs 24hrs with a sleep of 200 secs. I have writted a small script to kill the shell script when this config file is... (4 Replies)
Discussion started by: Lancel0t
4 Replies

7. AIX

a process that never stop

Dears all i have an AIX box in which i am facing a problem with a process as below: /usr/dt/bin/dtexec -open 0 -ttprocid and each time i am killing this process with "kill -9" then it run again after a while. any ideas or solutions will be appreciated. (13 Replies)
Discussion started by: TheEngineer
13 Replies

8. Shell Programming and Scripting

Stop / kill the process individually

Hi , I have a situation, where I have 10 indivudal processess started by similar instance.I say similar instance because each of them being started as a new thread: Say I've following unix process running process1_ADAP process2_ADAP process3_ADAP Current scenario: Now I have SHUTDOWN... (5 Replies)
Discussion started by: braindrain
5 Replies
Login or Register to Ask a Question