I know that I can solve this by these combinations, but having a "-l"
flag for sort would be much shorter to write and I am not so familiar
with perl.
It was just an idea to make things easier, if you don't like it, ignore it.
I need it atm for bug fixing other stuff, but searched for that a time
Georg Müller <[EMAIL PROTECTED]> writes:
> I would like to see a "sort by line length" in the sort tool.
awk '{ print length(), $0 }' input | sort -k1,1n | cut -d' ' -f2- > output
Andreas.
--
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg
Jim Meyering wrote:
> You can do this in perl (or awk, ruby, etc) as a one-liner,
> so it may not be worth adding to a C application:
>
> echo 1 938 four aa a | fmt -1 \
> | perl -ne 'push @line, $_;sub END{print sort {length $a<=>length $b}
> @line}'
> 1
> aa
> 938
> four
> a
Not to
Georg Müller wrote:
> Dear coreutils team,
>
> I would like to see a "sort by line length" in the sort tool.
>
> Is anything like this planned.
> It seems easy to implement.
> I could also write the code for that, if you wish.
That seems like a very specific need which
is probably best fulfilled
Georg Müller <[EMAIL PROTECTED]> wrote:
> I would like to see a "sort by line length" in the sort tool.
>
> Is anything like this planned.
> It seems easy to implement.
> I could also write the code for that, if you wish.
You can do this in perl (or awk, ruby, etc) as a one-liner,
so it may not be
According to Georg Müller on 4/24/2007 6:22 AM:
> Dear coreutils team,
>
> I would like to see a "sort by line length" in the sort tool.
>
> Is anything like this planned.
Not really planned, but it doesn't sound all that bad to me. Submit a
patch for discussion, if you would like. But it soun
Dear coreutils team,
I would like to see a "sort by line length" in the sort tool.
Is anything like this planned.
It seems easy to implement.
I could also write the code for that, if you wish.
Best regards,
Georg
___
Bug-coreutils mailing list
Bug-c
Eric Blake scripsit:
> Did you mean to use -k1,1 instead of -k1? Otherwise, you are stating that
> the key begins with the first field, but continues through the end of the
> line (with the field separators ignored), and since ' ' comes before '#',
> the output looked correct to me. Using -k1,1
Jim Meyering <[EMAIL PROTECTED]> wrote:
...
>> diff --git a/src/ls.c b/src/ls.c
>> index f412dff..c0e332b 100644
>> --- a/src/ls.c
>> +++ b/src/ls.c
>> @@ -2578,7 +2578,7 @@ gobble_file (char const *name, enum filetype type,
>> ino_t i
>> node,
>> && (type == symbolic_link || type == unk