[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

question about behavior of sort -n -t,

From: Gabriel Gaster
Subject: question about behavior of sort -n -t,
Date: Tue, 8 Oct 2013 16:18:03 -0500

Hello all,

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

The premise of the question I asked on stackoverflow here (

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

gabriel gaster
data scientist

datascope analytics

twitter: @gabegaster (
cell: +1.773.816.3349

skype: gabrielgaster

reply via email to

[Prev in Thread] Current Thread [Next in Thread]