How to sort on right most column

Tom Christiansen tchrist at convex.COM
Wed May 15 15:17:07 AEST 1991


>From the keyboard of rock at warp.Eng.Sun.COM (Bill Petro):
:How could I do this using either the sort command, or perl or awk?
:
:I have the following data in this format - I want to sort it on the
:right most column.  The columns are not tab delimited, and some of the
:columns have arbitrary numbers of words (specifically the third column
:from the left, column c).  Sort assumes that you start numbering on the
:left, and count from 0.  How would you start with the right most
:column, column e?
:
: FOO  BAR ACE CORPORATION                SUNNYVALE              2.00
: FOO  BAR ACER COMPUTED COMPANY          MILPITAS              20.00

How about?
    sort -t^A +0.60n

Assumptions:
    no control-A's in data
    the sort should be numeric
    the numbers don't begin until column 61

--tom
--
Tom Christiansen		tchrist at convex.com	convex!tchrist
		"So much mail, so little time." 



More information about the Comp.unix.shell mailing list