[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New sort(1) feature -- sort by length
From: |
Pádraig Brady |
Subject: |
Re: New sort(1) feature -- sort by length |
Date: |
Fri, 24 Jul 2009 10:48:24 +0100 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
Jim Meyering wrote:
> Pádraig Brady wrote:
>>
>> Also it's quite easy to achieve with existing tools:
>> awk '{print length, $0}' <file | sort -n | cut -f2- -d' '
>
> IMHO, this is a decisive argument for not adding the option.
> However, I would welcome a paragraph documenting the technique as
> an example of how to extend sort.
I'll mention the DSU idiom in the info docs,
with this as an example.
>> What might be better would be to add an option
>> to `wc` to get it to prepend various counts to a line
>> (words, chars, bytes, cells), which then could be
>> sorted and stripped as above.
>
> This is tempting, but I am reluctant to modify wc in this manner.
> wc is a fundamental tool, and adding a feature like this would
> seem to bring too little value for the impact on the code.
> It's easier to say "just use ___" (perl, awk, etc).
Having it in wc would allow one to easily count chars, bytes, cells.
But I agree it's not needed often enough to add.
cheers,
Pádraig.
- Re: New sort(1) feature -- sort by length, (continued)
- 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 <=
- Re: New sort(1) feature -- sort by length, Ethan Baldridge, 2009/07/24
- [PATCH] doc: add a sort by line length example to sort info, Pádraig Brady, 2009/07/24
- Re: [PATCH] doc: add a sort by line length example to sort info, Jim Meyering, 2009/07/25