How to sort on right most column

Jean-Pierre Radley jpr at jpradley.jpr.com
Thu May 23 05:15:22 AEST 1991


>From the keyboard of felps at convex.com (Robert Felps):
>:I don't know of any way to sort based on right to left. But you might try
>

With awk, $NF is the last field. So pipe the file through awk, prepending
the last field ($NF) to the whole line ($0), separated by something wierd,
say ^B. Pipe this to sort, then pipe to a sed to ditch characters up to and
including the ^B.
As I think of it, the first awk could be a sed filter too.

Jean-Pierre Radley   Unix in NYC   jpr at jpr.com   jpradley!jpr   CIS: 72160,1341



More information about the Comp.unix.shell mailing list