[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New sort(1) feature -- sort by length
From: |
Eric Blake |
Subject: |
Re: New sort(1) feature -- sort by length |
Date: |
Thu, 16 Jul 2009 22:07:49 -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 Ethan Baldridge on 7/16/2009 3:06 PM:
> I had a list to sort at work today that needed to be in the format "A B
> C D E... AA BB CC DD" but sort(1) only returns results as "A AA B BB C
> CC".
Thanks for the ideas; it is especially nice when ideas are accompanied by
a patch. However,...
sort is already quite powerful. I'm not sure we need a new command line
option unless we can prove there is no way to do what you want with the
existing options. Taking your example, here's a length-based sort:
$ echo A B C D E AA BB CC DD EE | tr ' ' '\n' | sort -k1,1.1 -k1,1.2
A
AA
B
BB
C
CC
D
DD
E
EE
>
> Here it is attached as a unified diff. I tested it and it seems to work
> naturally in conjunction with other operands, so I don't believe there
> are likely to be problems.
The HACKING file gives more ideas on how best to contribute a patch; we
prefer patches against the latest git sources, rather than the last release.
http://git.savannah.gnu.org/cgit/coreutils.git/tree/HACKING
- --
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
iEYEARECAAYFAkpf+RUACgkQ84KuGfSFAYDP2wCgx0LDEtKJm+QQOZ0ToDRAATx6
IPUAoJCxLznvpQsh/PfVWdI1sn6lP5it
=D+MC
-----END PGP SIGNATURE-----
- RE: New sort(1) feature -- sort by length, Ethan Baldridge, 2009/07/16
- New sort(1) feature -- sort by length, Ethan Baldridge, 2009/07/16
- Re: New sort(1) feature -- sort by length,
Eric Blake <=
- Re: New sort(1) feature -- sort by length, Pádraig Brady, 2009/07/17
- RE: New sort(1) feature -- sort by length, Ethan Baldridge, 2009/07/17
- Re: New sort(1) feature -- sort by length, Pádraig Brady, 2009/07/20
- Re: New sort(1) feature -- sort by length, Erik Auerswald, 2009/07/20
- Re: New sort(1) feature -- sort by length, Ethan Baldridge, 2009/07/23
- Re: New sort(1) feature -- sort by length, Pádraig Brady, 2009/07/23
- Re: New sort(1) feature -- sort by length, Jim Meyering, 2009/07/24
- Re: New sort(1) feature -- sort by length, Pádraig Brady, 2009/07/24