gnu sort utility does destructive sort? - Unix

This is a discussion on gnu sort utility does destructive sort? - Unix ; It seems the gnu sort utility does destructive sort? i.e. if my file is: b y b x and i do “sort -k 1 myFile” then the line got re-ordered? is there a way to use sort so that if ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: gnu sort utility does destructive sort?

  1. gnu sort utility does destructive sort?

    It seems the gnu sort utility does destructive sort?

    i.e. if my file is:

    b y
    b x

    and i do “sort -k 1 myFile” then the line got re-ordered?

    is there a way to use sort so that if the field is a tie, it leave the
    original order as is?

    Thanks

    Xah
    xah@xahlee.org
    http://xahlee.org/



  2. Re: gnu sort utility does destructive sort?

    Got the answer to my own question from help on freenode irc. To do non-
    destructive sort with gnu sort, use -s.

    http://xahlee.org/UnixResource_dir/unix_tips.html

    Xah
    xah@xahlee.org
    http://xahlee.org/



    On Apr 18, 5:10*pm, Xah wrote:
    > It seems the gnu sort utility does destructive sort?
    >
    > i.e. if my file is:
    >
    > b y
    > b x
    >
    > and i do “sort -k 1 myFile” then the line got re-ordered?
    >
    > is there a way to use sort so that if the field is a tie, it leave the
    > original order as is?
    >


+ Reply to Thread