home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / shell / 3942 < prev    next >
Encoding:
Text File  |  1992-09-14  |  1.7 KB  |  43 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!mcsun!sunic!ugle.unit.no!news
  3. From: Harald.Eikrem@delab.sintef.no
  4. Subject: Re: Alias and awk variables
  5. In-Reply-To: wonga@steam.chem.su.oz.au's message of Mon, 14 Sep 1992 03:36:54 GMT
  6. Message-ID: <1992Sep14.161649*Harald.Eikrem@delab.sintef.no>
  7. Sender: news@ugle.unit.no (NetNews Administrator)
  8. Organization: SINTEF DELAB, Trondheim, Norway.
  9. References: <1992Sep14.033654.11186@ucc.su.OZ.AU>
  10. Date: 14 Sep 92 16:16:49
  11. Lines: 30
  12.  
  13. ! How do make this command into a csh alias,
  14. ! ps -ef | awk '$1 !~ /root/ {print $0}'
  15.  
  16.   csh% alias psnot 'ps -fe | awk '\''$1 !~ /\!^/ { print }'\'
  17.   csh% psnot root
  18.        UID   PID  PPID  C    STIME TTY      TIME COMMAND
  19.     daemon   127     1  0  Sep 11  ?        0:00 sendmail -bd -q30m -accepting connections
  20.     harald 22191 22190  0 16:06:46 ttyu1    0:03 tcsh
  21.     harald 22574 22560 15 16:07:53 ttyu1    0:00 ps -fe
  22.     harald 22560 22191  3 16:07:05 ttyu1    0:01 csh
  23.     harald 22190     1  0 16:06:45 ?        0:00 xterm -sb -sl 500 +si -fg black -bg #dc00d0009300 +ut -T bor
  24.     harald 22575 22560  8 16:07:53 ttyu1    0:00 awk $1 !~ /root/ { print }
  25.   csh%
  26.  
  27. or simpler:
  28.  
  29.   csh% alias psnot 'ps -fe | grep -v "^ *\!^ "'
  30.   csh% psnot root
  31.        UID   PID  PPID  C    STIME TTY      TIME COMMAND
  32.     daemon   127     1  0  Sep 11  ?        0:00 sendmail -bd -q30m -accepting connections
  33.     harald 22191 22190  0 16:06:46 ttyu1    0:03 tcsh
  34.     harald 22578 22560 11 16:11:29 ttyu1    0:00 grep -v ^ *root
  35.     harald 22560 22191  4 16:07:05 ttyu1    0:01 csh
  36.     harald 22190     1  1 16:06:45 ?        0:01 xterm -sb -sl 500 +si -fg black -bg #dc00d0009300 +ut -T bor
  37.     harald 22577 22560 15 16:11:29 ttyu1    0:00 ps -fe
  38.   csh%
  39.  
  40.  
  41.   ~~harald E.
  42.