[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] doc: add a sort by line length example to sort info
From: |
Jim Meyering |
Subject: |
Re: [PATCH] doc: add a sort by line length example to sort info |
Date: |
Sat, 25 Jul 2009 10:18:48 +0200 |
Pádraig Brady wrote:
> Pádraig Brady wrote:
>> 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.
>
> attached
>>From 48d9b15477de1b6b53857642bc7c4aba0ccf9d67 Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?P=C3=A1draig=20Brady?= <address@hidden>
> Date: Sat, 25 Jul 2009 00:46:12 +0100
> Subject: [PATCH] doc: add a sort by line length example to sort info
s/ to sort info//
> * doc/coreutils.texi (sort invocation): Add an example showing how
> to sort data not directly supported by the sort command.
Nice. Thanks!
> ---
> doc/coreutils.texi | 11 +++++++++++
> 1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/doc/coreutils.texi b/doc/coreutils.texi
> index 4599a27..f1072a9 100644
> --- a/doc/coreutils.texi
> +++ b/doc/coreutils.texi
> @@ -4258,6 +4258,17 @@ by the sort operation.
> @c @end example
>
> @item
> +Use the common @acronym{DSU, Decorate Sort Undecorate} idiom to
> +sort lines according to their length.
> +
> address@hidden
> +awk '@{print length, address@hidden' </etc/passwd | sort -n | cut -f2- -d' '
> address@hidden example
It's ok to remove the '<'.
> +In general this technique can be used to sort data that the @command{sort}
> +command does not support directly.
- 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, 2009/07/24
- 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 <=