If I use the input file

        # cat IN
        a-1/x
        a-0/y
        a/z
        #

and execute 'sort -t / -k 1 < IN' (field separator is /, sort on first field) I get (what I believe to be) incorrect results:

        # sort -k1 -t / < IN
        a-0/y
        a-1/x
        a/z
        #

I would expect the record with the short value for field 1 to be first in the output.

Interestingly, it works as expected if the field delimiter is set to a space (and the input data updated accordingly):

        # sort -k1 -t ' ' < IN
        a z
        a-0 y
        a-1 x
        #

(It also works if no delimiter is specified on the command line, which defaults to "a sequence of blank-space characters".)


So, is this a bug? Or is this working-as-designed (and therefore my expectations need to be reset)?


+------------------+--------------------------+------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:      |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+------------------+--------------------------+------------------------+

Reply via email to