bug-coreutils
[Top][All Lists]
Advanced

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

Re: sort and multiple -k options


From: Eric Blake
Subject: Re: sort and multiple -k options
Date: Sun, 28 Jun 2009 08:41:44 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Andreas Schwab on 6/28/2009 2:28 AM:
>> i want to have the files sorted by (1) path then (2) file name then (3) cfg 
>> order.  so i use this:
>> sort -t% -k2 -k4 -k3
> 
> Your sort keys overlap.
> 
>   -k, --key=POS1[,POS2]     start a key at POS1 (origin 1), end it at POS2
>                             (default end of line)
>                             ^^^^^^^^^^^^^^^^^^^^^

To put it more directly, you want:

sort -t% -k2,2 -k4,4 -k3,3

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpHgSgACgkQ84KuGfSFAYAgWgCgi4STLM4eE2s48DVPAVV3gkAq
HIEAnRw1ixP1jSiql9HmcONkHPuf/CUE
=ZcOT
-----END PGP SIGNATURE-----




reply via email to

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