How to sort on right most column

Bill Petro rock at warp.Eng.Sun.COM
Wed May 15 11:04:26 AEST 1991


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?

  0    1   2                              3                     4

  a    b   c                              c                     e

 FOO  BAR ACE CORPORATION                SUNNYVALE              2.00
 FOO  BAR ACER COMPUTED COMPANY          MILPITAS              20.00
 FOO  BAR APOLLO COMPUTER, INC.          CHELMSFORD             1.00
 FOO  BAR APPLE COMPUTER, INC.           CUPERTINO              8.00
 FOO  BAR BOEING                         TUKWILA               53.00
 FOO  BAR BOEING COMPUTER SERVICES       EDDYSTONE              2.00
 FOO  BAR CITIBANK N. A.                 ANDOVER                4.00
 FOO  BAR CITIBANK NORTH AMERICA         LONG ISLAND CITY      26.00


Thanks!


--
     Bill Petro  {decwrl,hplabs,ucbvax}!sun!Eng!rock
"UNIX for the sake of the kingdom of heaven"  Matthew 19:12



More information about the Comp.unix.shell mailing list