posted by
davidcook at 03:30pm on 21/12/2007
So, a strange Unix thing I noticed today.
Given the following file :
Now try sorting it. First with just "-u" (sort uniquely) :
Now add "-n" to sort numerically (if the field looks like a number) :
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 ?
Given the following file :
> cat list2
1
1
2
A
BNow try sorting it. First with just "-u" (sort uniquely) :
> sort -u list2
1
2
A
BNow add "-n" to sort numerically (if the field looks like a number) :
> sort -un list2
A
1
2Where 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 ?
There are 4 comments on this entry. (Reply.)