Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!uflorida!gatech!udel!princeton!njin!drears From: drears@pilot.njin.net (Dennis G. Rears) Newsgroups: comp.unix.questions Subject: awk script Keywords: awk, ps, kill Message-ID: Date: 18 Mar 91 16:52:09 GMT Reply-To: drears@pica.army.mil Organization: NJ InterCampus Network, New Brunswick, N.J. Lines: 23 I need to write a shell script that will allow users to kill all thier processes associated that a program name. This script will run on a HP 9000/835, which is a SYSV Unix. I am having problems with the awk script in the following script fragment: CMD='artemis' ME=`whoami` PROC=`ps -ef|grep /${CMD}| \ awk '{ $1 == ${ME} && $8 != "grep" $2 }' ` kill -HUP ${PROC} I want awk to output the process numbers (Field 2) where the username (field 1) is equal to the variable ${ME} and field 8 is not equal to 'grep'. Once I get that I can just do a "kill -HUP ${PROC}" Can anyone tell me what I am doing wrong or suggest a different way of doing it. This is one of my first attempts at using awk. Thanks in advance. Dennis