davidcook: (circuit)
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 ?
Mood:: 'geeky' geeky

November

SunMonTueWedThuFriSat
          1 2
 
3
 
4
 
5
 
6
 
7
 
8
 
9
 
10
 
11
 
12
 
13
 
14
 
15
 
16
 
17
 
18
 
19
 
20
 
21
 
22
 
23
 
24
 
25
 
26
 
27
 
28
 
29
 
30