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