How to sort variable columns file

How to sort variable columns file

Post by Sang DeSibt » Sun, 02 Sep 2001 15:06:19



How does one sort a variable length file with multiple columns like this:-

one   two   three
two   three four            file         six
555   abd         jkj      how    to       yes
no      junk         what    is    bah     boo    time
shell   lynk

uniz

              linux
    solaris          thank  
 you   1234  333    a-b      be-- tab     os

TIA

 
 
 

How to sort variable columns file

Post by Chris F.A. Johnso » Sun, 02 Sep 2001 15:10:07



Quote:> How does one sort a variable length file with multiple columns like this:-

> one   two   three
> two   three four            file         six
> 555   abd         jkj      how    to       yes
> no      junk         what    is    bah     boo    time
> shell   lynk

> uniz

>               linux
>     solaris          thank
>  you   1234  333    a-b      be-- tab     os

man sort

How do you want it sorted? If "man sort" doesn't help, give us more
information and we'll try to help.

--
    Chris F.A. Johnson                        http://cfaj.freeshell.org
    ===================================================================
    My code (if any) in this post is copyright 2001, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License

 
 
 

1. SORT command > sorting decimal numbers in columns on a file not working !

Hi. I try to sort a column on a file containing decimal numbers. I use
Sse Linux 9.1. Then I try to do this:


doasidpoas   opipo     7.8
kjkljkljklji   kjklj   35.7
kljkljkl       kljkl   2.3
dopasidp       poipo   0.2
kjkljlkl       kjkl    0.0
kljkljkjl      ljlk    0.8
jklhkljkl      kjkl    0.0
kljkljkljl     kjkl    0.1

dopasidp       poipo   0.2
jklhkljkl      kjkl    0.0
kjkljlkl       kjkl    0.0
kljkljkjl      ljlk    0.8
kljkljkljl     kjkl    0.1
kljkljkl       kljkl   2.3
doasidpoas   opipo     7.8
kjkljkljklji   kjklj   35.7

kjkljkljklji   kjklj   35.7
doasidpoas   opipo     7.8
kljkljkl       kljkl   2.3
kljkljkljl     kjkl    0.1
kljkljkjl      ljlk    0.8
kjkljlkl       kjkl    0.0
jklhkljkl      kjkl    0.0
dopasidp       poipo   0.2

As you can see the sorting order is not correct. What am I doing wrong ?
I also tried to use '-g' option instead of '-n' but doesnt work.

Any idea ?

Thanks
Alberto

2. unable to resolve XpmFree

3. Sorting By Second Column With Unique First Column

4. Port 27015?

5. How to have sort start sorting froma given column?

6. socket limits on Solaris 2.6

7. how do I sort a file based on multiple columns

8. boca bb1008 locking under linux

9. Sorting a 2 column text file

10. Help to sort a file on particlular columns

11. How to read lines from text file with multiple columns into individual variables

12. sed/awk : need just the first column in a multi-column file

13. File Sort: How good is Unix sort?