Re: cvs commit: src/bin/ls cmp.c extern.h ls.1 ls.c util.c

[ Available lists | Index of cvs-all | Month of Jun 2005 | Week of 4 Jun 2005 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Bruce Evans <bde@zeta.org.au>
Date
4 Jun 2005 11:16:49
Subject
Re: cvs commit: src/bin/ls cmp.c extern.h ls.1 ls.c util.c
Message-ID
20050604205558.I5262@epsplex.bde.org


[ Hide this part ]
On Sat, 4 Jun 2005, Mathieu Arnold wrote:

> +-le 04/06/2005 01:17 +1000, Tim Robbins crivait :
> | On Fri, Jun 03, 2005 at 11:05:59AM +0000, Dima Dorfman wrote:
> |> dd 2005-06-03 11:05:58 UTC
> |>
> |> FreeBSD src repository
> |>
> |> Modified files:
> |> bin/ls cmp.c extern.h ls.1 ls.c util.c
> |> Log:
> |> Add the -S option to sort files by size. NetBSD and OpenBSD already
> |> have this option with identical semantics (sorting large files first).
> |> -r can be used to reverse the sort if that is desired.
> |
> | How is this different from |sort -k5,5nr?
>
> Works only if you use "-l".

Use -l then:

ls -l | sort -k5,5nr | awk '!/^total/ {print $9}'

This shows another bug: the "totals" line gets in the way for filters
simpler than the above and is documented to not be printed (for ls -l)
unless the output is to a terminal but it is actually printed independently
of the output device. ls -s is documented to print totals like ls -l
but works as documented for non-terminals despite the code that prints
it being identical.

ls -CS # no easy way to do this with a filter but who cares

Bruce


Elapsed time: 0.202 seconds