number sort - Unix

This is a discussion on number sort - Unix ; Hi, Here is some data: aaa,-1.09221e+06,-30955,35.569 bbb,1.13284e+06,67479,16.735 ccc,1.78407e+06,93986,20.9255 ddd,25.92,4,6.48 eee,108.65,25,4.32 I want to sort them by the second column. "sort -t, -n -k 2,2" does not work. Maybe sort does not understand "e+06". Can any one help? I am using ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: number sort

  1. number sort

    Hi,


    Here is some data:
    aaa,-1.09221e+06,-30955,35.569
    bbb,1.13284e+06,67479,16.735
    ccc,1.78407e+06,93986,20.9255
    ddd,25.92,4,6.48
    eee,108.65,25,4.32


    I want to sort them by the second column. "sort -t, -n -k 2,2" does not
    work. Maybe sort does not understand "e+06". Can any one help? I am
    using /bin/sh on a solaris 8 server.


    Thanks!


  2. Re: number sort

    On 27 Jan 2006 07:06:11 -0800, whcui@yahoo.com wrote:
    [...]
    > Here is some data:
    > aaa,-1.09221e+06,-30955,35.569
    > bbb,1.13284e+06,67479,16.735
    > ccc,1.78407e+06,93986,20.9255
    > ddd,25.92,4,6.48
    > eee,108.65,25,4.32
    >
    >
    > I want to sort them by the second column. "sort -t, -n -k 2,2" does not
    > work. Maybe sort does not understand "e+06". Can any one help? I am
    > using /bin/sh on a solaris 8 server.

    [...]

    Your question has already been anwered in comp.unix.shell.
    Please don't multipost. Use crosspost instead if you need to
    post in several newsgroups at a time (which should not be the
    case for this question).

    --
    Stephane

+ Reply to Thread