Xref: utzoo comp.unix.shell:2180 comp.lang.perl:5299 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!sun-barr!newstop!exodus!warp.Eng.Sun.COM!rock From: rock@warp.Eng.Sun.COM (Bill Petro) Newsgroups: comp.unix.shell,comp.lang.perl Subject: How to sort on right most column Message-ID: <13320@exodus.Eng.Sun.COM> Date: 15 May 91 01:04:26 GMT Sender: news@exodus.Eng.Sun.COM Followup-To: comp.unix.shell Lines: 30 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