Sort on Mandrake-Mandriva - Mandrake

This is a discussion on Sort on Mandrake-Mandriva - Mandrake ; This is a problem I noticed years ago in an old version of Mandrake, and trying to sort a file with Mandriva 2007 it seems to be the same. I'm not sure it's a bug, perhaps I missed something. This ...

+ Reply to Thread
Results 1 to 10 of 10

Thread: Sort on Mandrake-Mandriva

  1. Sort on Mandrake-Mandriva

    This is a problem I noticed years ago in an old version of Mandrake, and
    trying to sort a file with Mandriva 2007 it seems to be the same. I'm not
    sure it's a bug, perhaps I missed something.

    This is a text file:
    ***********
    dog
    ZEBRA
    DOG
    Dog
    Zebra
    ALLIANCE
    zebra
    cat
    alliance
    CAT
    Alliance
    Cat
    *************

    If I run sort -f I get:

    alliance
    Alliance
    ALLIANCE
    cat
    Cat
    CAT
    dog
    Dog
    DOG
    zebra
    Zebra
    ZEBRA

    ***************

    But also without the -f option I obtain the same output, while I would
    expect the lines beginning with capital letters to be placed *before* the
    other ones. I remember seeing this in other distributions and perhaps in
    Cygwin.

    Is this correct?

    Thanks!
    guido m.

    --
    Guido Milanese
    Vocal Ensemble Ars Antiqua, Genova (Genoa), Italy
    http://www.arsantiqua.org

  2. Re: Sort on Mandrake-Mandriva

    On Mon, 05 Feb 2007 23:58:39 +0100, Guido Milanese wrote:
    > This is a problem I noticed years ago in an old version of Mandrake, and
    > trying to sort a file with Mandriva 2007 it seems to be the same. I'm not
    > sure it's a bug, perhaps I missed something.


    alias sort='sort -f' ??????
    ^^^^^
    Jonesy
    --
    Marvin L Jones | jonz | W3DHJ | linux
    38.24N 104.55W | @ config.com | Jonesy | OS/2
    *** Killfiling google posts:

  3. Re: Sort on Mandrake-Mandriva

    On 2007-02-05, Guido Milanese wrote:
    > This is a problem I noticed years ago in an old version of Mandrake, and
    > trying to sort a file with Mandriva 2007 it seems to be the same. I'm not
    > sure it's a bug, perhaps I missed something.
    >
    > This is a text file:
    > ***********
    > dog
    > ZEBRA
    > DOG
    > Dog
    > Zebra
    > ALLIANCE
    > zebra
    > cat
    > alliance
    > CAT
    > Alliance
    > Cat
    > *************
    >
    > If I run sort -f I get:
    >
    > alliance
    > Alliance
    > ALLIANCE
    > cat
    > Cat
    > CAT
    > dog
    > Dog
    > DOG
    > zebra
    > Zebra
    > ZEBRA
    >
    > ***************
    >
    > But also without the -f option I obtain the same output, while I would
    > expect the lines beginning with capital letters to be placed *before* the
    > other ones. I remember seeing this in other distributions and perhaps in
    > Cygwin.


    My guess is it's a locale issue. Some time ago, POSIX
    decreed that sorting would be turned inside out to
    accomodate many more languages. To get sort and ls to order
    things in the traditional pre-POSIX way, set environment
    variable LC_COLLATE to a value of "C" (without the quotation
    marks).

    For more information, do 'man locale'.

    HTH

    --
    Robert Riches
    spamtrap42@verizon.net
    (Yes, that is one of my email addresses.)

  4. Re: Sort on Mandrake-Mandriva

    export LC_CTYPE=C

    Your LC type is not what you want. C gives the old stuff, en_US.UTF-8 is
    probably what yours is at now, and it orders the letters to ignore case.


    Guido Milanese writes:

    >This is a problem I noticed years ago in an old version of Mandrake, and
    >trying to sort a file with Mandriva 2007 it seems to be the same. I'm not
    >sure it's a bug, perhaps I missed something.


    >This is a text file:
    >***********
    >dog
    >ZEBRA
    >DOG
    >Dog
    >Zebra
    >ALLIANCE
    >zebra
    >cat
    >alliance
    >CAT
    >Alliance
    >Cat
    >*************


    >If I run sort -f I get:


    >alliance
    >Alliance
    >ALLIANCE
    >cat
    >Cat
    >CAT
    >dog
    >Dog
    >DOG
    >zebra
    >Zebra
    >ZEBRA


    >***************


    >But also without the -f option I obtain the same output, while I would
    >expect the lines beginning with capital letters to be placed *before* the
    >other ones. I remember seeing this in other distributions and perhaps in
    >Cygwin.


    >Is this correct?


    >Thanks!
    >guido m.


    >--
    >Guido Milanese
    >Vocal Ensemble Ars Antiqua, Genova (Genoa), Italy
    >http://www.arsantiqua.org


  5. Re: Sort on Mandrake-Mandriva

    Unruh wrote:

    > export LC_CTYPE=C
    >
    > Your LC type is not what you want. C gives the old stuff, en_US.UTF-8 is
    > probably what yours is at now, and it orders the letters to ignore case.


    Thank you. This is true, but with this LC type I cannot sort texts with
    accents. For example, this text containing some Spanish, German and italian
    words is sorted with the accents at the end, which is wrong:

    alliance
    cat
    dog
    zebra
    Übung
    *lbero
    él
    üben

    So it seems that I can either give up the '-f' option or accept a wrong
    sorting of accented letters.

    Any other hint?

    Thanks a lot,
    guido m., italy


    -----------
    Guido Milanese
    Vocal Ensemble Ars Antiqua, Genova (Genoa), Italy
    http://www.arsantiqua.org

  6. Re: Sort on Mandrake-Mandriva

    Allodoxaphobia wrote:

    > alias sort='sort -f' ??????


    Thank you for your answer. I checked but it's not the case. It's a LC
    problem, which I cannot fix (see my other message).

    Best regards,
    guido m., italy

    --
    Guido Milanese
    Vocal Ensemble Ars Antiqua, Genova (Genoa), Italy
    http://www.arsantiqua.org

  7. Re: Sort on Mandrake-Mandriva

    Robert M. Riches Jr. wrote:

    >
    > My guess is it's a locale issue. Some time ago, POSIX
    > decreed that sorting would be turned inside out to
    > accomodate many more languages. To get sort and ls to order
    > things in the traditional pre-POSIX way, set environment
    > variable LC_COLLATE to a value of "C" (without the quotation
    > marks).


    Thank you very much. Very interesting! I seems that the variable to change
    is LC_TYPE, but it gives other problems (see my answer to 'Unruh''s
    message).

    Best regards,
    guido m., italy

    --
    Guido Milanese
    Vocal Ensemble Ars Antiqua, Genova (Genoa), Italy
    http://www.arsantiqua.org

  8. Re: Sort on Mandrake-Mandriva

    Unruh writes:

    >export LC_CTYPE=C


    OOps it is LC_COLLATE for sort, not LC_CTYPE. And since you live in Italy,
    your UTF8 is probably not en_US. Sorry.


    >Your LC type is not what you want. C gives the old stuff, en_US.UTF-8 is
    >probably what yours is at now, and it orders the letters to ignore case.



    >Guido Milanese writes:


    >>This is a problem I noticed years ago in an old version of Mandrake, and
    >>trying to sort a file with Mandriva 2007 it seems to be the same. I'm not
    >>sure it's a bug, perhaps I missed something.


    >>This is a text file:
    >>***********
    >>dog
    >>ZEBRA
    >>DOG
    >>Dog
    >>Zebra
    >>ALLIANCE
    >>zebra
    >>cat
    >>alliance
    >>CAT
    >>Alliance
    >>Cat
    >>*************


    >>If I run sort -f I get:


    >>alliance
    >>Alliance
    >>ALLIANCE
    >>cat
    >>Cat
    >>CAT
    >>dog
    >>Dog
    >>DOG
    >>zebra
    >>Zebra
    >>ZEBRA


    >>***************


    >>But also without the -f option I obtain the same output, while I would
    >>expect the lines beginning with capital letters to be placed *before* the
    >>other ones. I remember seeing this in other distributions and perhaps in
    >>Cygwin.


    >>Is this correct?


    >>Thanks!
    >>guido m.


    >>--
    >>Guido Milanese
    >>Vocal Ensemble Ars Antiqua, Genova (Genoa), Italy
    >>http://www.arsantiqua.org


  9. Re: Sort on Mandrake-Mandriva

    Unruh wrote:

    > OOps it is LC_COLLATE for sort, not LC_CTYPE. And since you live in Italy,
    > your UTF8 is probably not en_US. Sorry.


    Yes, it is it_IT.UTF-8 (by the way, the shell adds: "not a valid
    identifier"), hard to understand : the same I get also if I set it to
    en_US.UTF-8. But the real problem is the other one: it seem that either (1)
    I give up the '-f' option or (2) I give up the correct sorting of accented
    chars. Being a linguist, I am not very glad of this situation.

    Thanks,
    gm

    Guido Milanese
    Vocal Ensemble Ars Antiqua, Genova (Genoa), Italy
    http://www.arsantiqua.org

  10. Re: Sort on Mandrake-Mandriva

    Guido Milanese writes:

    >Unruh wrote:


    >> OOps it is LC_COLLATE for sort, not LC_CTYPE. And since you live in Italy,
    >> your UTF8 is probably not en_US. Sorry.


    >Yes, it is it_IT.UTF-8 (by the way, the shell adds: "not a valid
    >identifier"), hard to understand : the same I get also if I set it to
    >en_US.UTF-8. But the real problem is the other one: it seem that either (1)
    >I give up the '-f' option or (2) I give up the correct sorting of accented
    >chars. Being a linguist, I am not very glad of this situation.


    Write your own collating file that does what you want!
    That is the beauty of Linux.
    (But no, I cannot guide you in doing so. Have never done it myself.)


    >Thanks,
    >gm


    >Guido Milanese
    >Vocal Ensemble Ars Antiqua, Genova (Genoa), Italy
    >http://www.arsantiqua.org


+ Reply to Thread