home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!elroy.jpl.nasa.gov!swrinde!cs.utexas.edu!hermes.chpc.utexas.edu!news.utdallas.edu!convex!tchrist
- From: tchrist@convex.COM (Tom Christiansen)
- Newsgroups: comp.unix.shell
- Subject: Re: Sort problem . .
- Message-ID: <1992Jul29.162453.17880@news.eng.convex.com>
- Date: 29 Jul 92 16:24:53 GMT
- References: <1992Jul29.072924*Harald.Eikrem@delab.sintef.no> <1992Jul29.160600.9623@leland.Stanford.EDU>
- Sender: usenet@news.eng.convex.com (news access account)
- Reply-To: tchrist@convex.COM (Tom Christiansen)
- Organization: CONVEX Realtime Development, Colorado Springs, CO
- Lines: 31
- Originator: tchrist@pixel.convex.com
- Nntp-Posting-Host: pixel.convex.com
- X-Disclaimer: This message was written by a user at CONVEX Computer
- Corp. The opinions expressed are those of the user and
- not necessarily those of CONVEX.
-
- From the keyboard of peer@ccrma.stanford.edu (Peer Landa):
- :It seems like this is getting out of hand, or drifting away from my original
- :posting . . where I asked to get a command line (or script) to list & sort all
- :my processes by memory use without getting the "title line" on the bottom --
- :i.e the "title line" shall stay at the top (that's why 'ps uax | sort -nr +3'
- :doesn't work). One way to do this (thanks to Erick Rudiak) is:
-
- :TITLELINE=`ps aux | head -1`
-
- Just use
-
- ps u$$ | sed 1q
-
- :echo "$TITLELINE"
-
- And now you can delete that.
-
- :ps -aux | grep -v PID | sort -rn +3
-
- No need to grep every line:
-
- ps aux | sed 1d | sort -rn +3
-
- although the perl solution runs faster, to my admitted surprise.
-
- --tom
- --
- Tom Christiansen tchrist@convex.com convex!tchrist
- If you have ever seen the grim word "login:" on a screen, your mind
- is now a wholly-owned subsidiary of The Death Star.
- John Woods in <14105@ksr.com> of comp.unix.bsd
-