View Single Post

  #3 (permalink)  
Old 04-12-2006, 03:36 PM
sparky sparky is offline
Member
User
 
Join Date: Mar 2006
Posts: 35
Rep Power: 0
sparky
Default

thanks for your reply.
Not tried your line of code as unsure what it all means

progress:
i.ve used grep to get both lines for port i need
saved them to file
used sed to delete the line with run in it so iam only left with one line.

where i am stuck now is how to get awk to turn $2 in to var so as i can then kill that proccess

Code:
#!/bin/sh
tmpfile=tmpfile.txt
run=run
tmpfile1=tempile1.txt

[ ! -f $tmpfile ] && > $tmpfile
[ ! -f $tmpfile1 ] && > $tmpfile1

echo "Enter a port"
read port

ps auxww | grep $port >> $tmpfile             #gets both line


sed "/$run/d" $tmpfile >> $tmpfile1          #deletes line i don t need
	mv $tmpfile1 $tmpfile                    #1 line left $2 pid number i need

#need to cat $tmpfile then | awk '{print $2}'  
# and kill $2
thanks
Reply With Quote