[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sort -t: -k1 behaves strangely
From: |
Eric Blake |
Subject: |
Re: sort -t: -k1 behaves strangely |
Date: |
Mon, 23 Apr 2007 22:05:10 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.5.666 |
According to John Cowan on 4/23/2007 8:50 PM:
> Given the input (without the leading spaces)
>
> Test Case:#1
> Test:#2
>
> the command "LC_ALL=C sort -t: -k1" outputs the same, though the
> key "Test" should sort before "Test Case".
Did you mean to use -k1,1 instead of -k1? Otherwise, you are stating that
the key begins with the first field, but continues through the end of the
line (with the field separators ignored), and since ' ' comes before '#',
the output looked correct to me. Using -k1,1 swaps the line to list #2 first.
--
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
signature.asc
Description: OpenPGP digital signature