[NTLUG:Discuss] Sort question

Fred fredstevens at yahoo.com
Thu Apr 5 08:40:29 CDT 2012


I have a long table with 6 columns of numbers. I want each row of 6 numbers to 

be arranged in ascending order and separated by some delimiter such as
comma or space, like this:

53 17 3 24 9 33 

16 8 42 29 1 20
<etc>

would become

3 9 17 24 33 53
1 8 16 20 29 42
<etc>

My code was getting really stupid but that was maybe because it was
really late. Actually, I don't know how to do this. I tried openoffice calc
at first but it scrambled the table. I put the data into a text file but none
of the single digit numbers have a leading zero so none of my feeble 

attempts at scripting worked very well.

I might mention that I also have the table in csv format instead of space
separated, if that might help.


Any suggestions?

Thanks,
Fred




More information about the Discuss mailing list