home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / shell / 3159 < prev    next >
Encoding:
Text File  |  1992-07-28  |  1.9 KB  |  51 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!news.utdallas.edu!convex!tchrist
  3. From: Tom Christiansen <tchrist@convex.COM>
  4. Subject: Re: Sort problem . .
  5. Message-ID: <1992Jul28.102938.12375@news.eng.convex.com>
  6. Originator: tchrist@pixel.convex.com
  7. Sender: usenet@news.eng.convex.com (news access account)
  8. Nntp-Posting-Host: pixel.convex.com
  9. Reply-To: tchrist@convex.COM (Tom Christiansen)
  10. Organization: CONVEX Realtime Development, Colorado Springs, CO
  11. References: <1992Jul27.123415.977@leland.Stanford.EDU> <1992Jul27.140110.846@news.eng.convex.com> <1992Jul28.095415.4640@prl.dec.com>
  12. Date: Tue, 28 Jul 1992 10:29:38 GMT
  13. X-Disclaimer: This message was written by a user at CONVEX Computer
  14.               Corp. The opinions expressed are those of the user and
  15.               not necessarily those of CONVEX.
  16. Lines: 33
  17.  
  18. From the keyboard of boyd@prl.dec.com (Boyd Roberts):
  19. :In article <1992Jul27.140110.846@news.eng.convex.com>, Tom Christiansen <tchrist@convex.COM> writes:
  20. :> 
  21. :> ps axu | ( sed 1q ; sort -nr +3 ) 
  22. :> 
  23. :
  24. :Eh?  Since when does sed do `unbuffered' reads?
  25. :
  26. :    prl313 ; @{echo 1 ; echo 2 ; echo 3} | @{sed 1q ; cat}
  27.               ^^                        ^^^^^^
  28. Sure looks like perl to me. :-)
  29.  
  30. :Nice idea though...
  31.  
  32. Hey -- it surprised the heck out of me too!  But it did indeed work
  33. without losing lines on a test run.  Unforunately, I ran but one test, 
  34. and must have just gotten lucky, cause now I lose lines.
  35.  
  36. This does seem to work:
  37.  
  38.     ps axu | (read line; echo "$line"; sort +3rn) 
  39.  
  40. I really loathe stdio sometimes, but I'm sure we're stuck with it
  41. until the end of time.  The buffering on both reading and writing 
  42. needs to be controllable without modifying the program or tricking
  43. it into thinking you're a tty.
  44.  
  45. --tom
  46. -- 
  47.     Tom Christiansen      tchrist@convex.com      convex!tchrist
  48.  
  49.     "* Unix is a footnote of AT&T Bell Laboratories."
  50.                              --Barry Shein
  51.