'sort' in mac terminal : wierdo 
'sort' in my mac is behaving really strangely. It does not seem to differentiate files based on case and also deletes the entire content of files.
Here is a simple text file:

'sort'ing in terminal is fine, while redirecting to a file however the original content is lost and the new file is never created !! I ran these in a gentoo box and it works fine there.

This can be a quite disastrous. Imagine you had some file that took you hours of work to produce and you forgot to back up, and sort quite neatly sorts it - by turning it into a blank file.
Added to the fact that there is no Java 6 on mac yet, this adds yet another accolade to apple's mac for being an even greater nuisance for developers.
Earlier I experienced a different behavior. 'sort' would modify the contents of the file 'a' as well as create a sorted version of 'A' on running `cat a | sort > A`. And, finally a friend reports that this works fine in his mac. This makes it even more annoying.