home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / programm / 5660 < prev    next >
Encoding:
Text File  |  1992-12-11  |  1.3 KB  |  49 lines

  1. Newsgroups: comp.unix.programmer
  2. Path: sparky!uunet!usc!cs.utexas.edu!sdd.hp.com!caen!uvaarpa!murdoch!fulton.seas.Virginia.EDU!tdh6t
  3. From: tdh6t@fulton.seas.Virginia.EDU (Todd #$%!@! Hodes)
  4. Subject: ***  Simple batch-style Unix question
  5. Message-ID: <1992Dec11.222613.10867@murdoch.acc.Virginia.EDU>
  6. Followup-To: sender
  7. Sender: usenet@murdoch.acc.Virginia.EDU
  8. Organization: University of Virginia, Dept. of Computer Science
  9. Date: Fri, 11 Dec 1992 22:26:13 GMT
  10. Lines: 37
  11.  
  12.         Firstly, I'm under SunOS 4.1.1.
  13.  
  14.         Now... say I've gotten a process ID from grep'ing a
  15. ps command, and want to send it to a 'kill -9'
  16.  
  17.         How do I do this ?
  18.  
  19. ps -aux | grep "xv " | sort -2 | awk '{if (NR == 1) print $2;}' |  kill -9
  20.  
  21. fails on the last pipe (the kill)
  22.  
  23. as does:
  24.  
  25. kill-9 < ps -aux | grep "xv " | sort -2 | awk '{if (NR == 1) print $2;}'
  26.  
  27. while:
  28.  
  29. ps -aux | grep "xv " | sort -2 | awk '{if (NR == 1) print $2;}' | cat
  30.  
  31. outputs the correct pid.
  32.  
  33. helga7 /home/tdh6t/bin >getPid
  34. 770
  35. helga7 /home/tdh6t/bin >ps -aux | grep "xv "
  36. tdh6t      770  0.0 15.1 1780 2232 co S    17:13   0:12 xv 
  37.  
  38. This is in a unix book somewhere, but I haven't left the lab to buy one
  39. in about 3 years.  :>
  40.  
  41. Todd
  42. -----
  43.  
  44. Louder Tunes == Better Code
  45.  
  46.      __|| __||       Todd Hodes
  47.     (____(____)      tdh6t@virginia.edu
  48. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  49.