Ancient sort version?

Linda haniganwork at earthlink.net
Mon Aug 5 21:10:02 UTC 2013


On 08/05/2013 03:32 PM, Colin Watson wrote:
> On Mon, Aug 05, 2013 at 03:10:03PM -0500, Linda wrote:
>> On 08/05/2013 01:56 PM, Mike Kupfer wrote:
>>> So "sort +2" is equivalent to "sort -k 3". cheers, mike
>> Just curious what -k denotes I checked man sort and it says start a
>> key at POS1 end at POS2 but I'm not sure what that means. So what is
>> a key?
>> I've always used -t and sorted by fields just curious what it means
>> to sort by a key.
> -t changes how fields are delimited; -k selects which fields (or
> characters within those fields) to sort on.  As an example:
>
>    $ cat input
>    key1:ccc
>    key2:bbb
>    key3:aaa
>    $ sort -t: -k2 input
>    key3:aaa
>    key2:bbb
>    key1:ccc
>
So where I do a system call in a c++ program of  sort -t^ 
+11 -10 +2 -6 that actually is no longer the correct way to 
do it and I should start figuring out how to use -k instead? 
I'm sure glad most things are backward compatible but I 
gather I should figure it out and fix my calls to sort so 
they use current syntax before it starts breaking things!
                     Thanks
                     Linda




More information about the ubuntu-users mailing list