Hello all,

I have a question about the behavior of sort -n.

The premise of the question I asked on stackoverflow here 
(http://stackoverflow.com/questions/19228968/unix-sort-n-t-gives-unexpected-result)
 

Evidently, even if a user specifies a field-separator, the entire line is still 
treated as a key. If the entire key is not numeric, then sort -n does not throw 
any errors and seems to not do numeric sort and rather does some other sort 
(the order of which I am unclear on). This strikes me as unexpected behavior -- 
because the caller can think he's going to get numeric sort and not get numeric 
sort.

As far as I can tell, specifying field-separator and calling numeric *should* 
sort numerically _if_ the key is numeric.  Furthermore -- and I suppose this is 
the main thing -- if a field-separator is specified, then the key should 
default to each field and not to the entire line. Why else would one specify a 
field-separator if not to use it in this way?

Can someone shed more light into this ? I'm also not sure if there is an 
existing conversation about this, if it's being changed in a later release, or 
if this is a known and long debated issue, or whatnot.

I'm eager to make contributions in this regard, of course. I would mostly like 
to know the current discussion of these things and what the current thinking is 
on sort -n -t','.

Thanks much
Gabe

--
gabriel gaster
data scientist

datascope analytics
http://datascopeanalytics.com

twitter: @gabegaster (https://twitter.com/gabegaster)
cell: +1.773.816.3349

skype: gabrielgaster

Reply via email to