Re: sort oddity

Shawn Bayern (shawn.bayern@yale.edu)
Fri, 5 Mar 1999 17:58:47 -0500 (EST)

On Fri, 5 Mar 1999, Ken Lai wrote:

> Try this:
> ps aux | tail +2 | sort +1
>
> It should sort by the 2nd field (pid), but there are a couple out of
> order. Anyone happen to know why? I notice they're the lines from
> special uid's like bin, daemon, lpr, nobody, etc...

Read the man page! :) Seriously, this is just a matter of flags to a
common command.

You're (a) sorting numbers, so you have to use -n, and (b) sorting based
on fields of variable length, so you have to use -b ("ignore leading
blanks").

Shawn