David Cook (davidcook) wrote,
David Cook
davidcook

  • Mood:

Apparently there's a bug in sort ... or something.

So, a strange Unix thing I noticed today.

Given the following file :

> cat list2
1
1
2
A
B


Now try sorting it. First with just "-u" (sort uniquely) :

> sort -u list2
1
2
A
B


Now add "-n" to sort numerically (if the field looks like a number) :

> sort -un list2
A
1
2


Where did the "B" go ??
I've seen this in sort under Solaris 8, the GNU version in Ubuntu 7.04 and the gnuwin32 version on Windows. Surely it's a bug ?
Subscribe

  • Books read in 2017 ...

    Angel of Storms - Trudi Canavan The Rhesus Chart - Charles Stross Magic for Nothing - Seanan McGuire The Annihilation Score - Charles Stross An…

  • DW and LJ

    In case anyone is looking for me on Dreamwidth, same username as on LJ (since, ummm ... 2009 !) Original post on Dreamwidth - there are…

  • Movies in 2015 ...

    Well, I'm cheating a bit, because I only saw one at the cinema, Star Wars: The Force Awakens, but I want to note down a few thoughts I had on it ...…

  • Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 4 comments