home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.programmer
- Path: sparky!uunet!usc!cs.utexas.edu!sdd.hp.com!caen!uvaarpa!murdoch!fulton.seas.Virginia.EDU!tdh6t
- From: tdh6t@fulton.seas.Virginia.EDU (Todd #$%!@! Hodes)
- Subject: *** Simple batch-style Unix question
- Message-ID: <1992Dec11.222613.10867@murdoch.acc.Virginia.EDU>
- Followup-To: sender
- Sender: usenet@murdoch.acc.Virginia.EDU
- Organization: University of Virginia, Dept. of Computer Science
- Date: Fri, 11 Dec 1992 22:26:13 GMT
- Lines: 37
-
- Firstly, I'm under SunOS 4.1.1.
-
- Now... say I've gotten a process ID from grep'ing a
- ps command, and want to send it to a 'kill -9'
-
- How do I do this ?
-
- ps -aux | grep "xv " | sort -2 | awk '{if (NR == 1) print $2;}' | kill -9
-
- fails on the last pipe (the kill)
-
- as does:
-
- kill-9 < ps -aux | grep "xv " | sort -2 | awk '{if (NR == 1) print $2;}'
-
- while:
-
- ps -aux | grep "xv " | sort -2 | awk '{if (NR == 1) print $2;}' | cat
-
- outputs the correct pid.
-
- helga7 /home/tdh6t/bin >getPid
- 770
- helga7 /home/tdh6t/bin >ps -aux | grep "xv "
- tdh6t 770 0.0 15.1 1780 2232 co S 17:13 0:12 xv
-
- This is in a unix book somewhere, but I haven't left the lab to buy one
- in about 3 years. :>
-
- Todd
- -----
-
- Louder Tunes == Better Code
-
- __|| __|| Todd Hodes
- (____(____) tdh6t@virginia.edu
- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-