Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Jun 2005 21:16:45 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Mathieu Arnold <mat@mat.cc>
Cc:        cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org, Tim Robbins <tjr@FreeBSD.org>, Dima Dorfman <dd@FreeBSD.org>
Subject:   Re: cvs commit: src/bin/ls cmp.c extern.h ls.1 ls.c util.c
Message-ID:  <20050604205558.I5262@epsplex.bde.org>
In-Reply-To: <44DA2BAD00E3D78FB3E03F96@cc-171.int.t-online.fr>
References:  <200506031105.j53B5xBv040850@repoman.freebsd.org> <20050603151728.GA77595@cat.robbins.dropbear.id.au> <44DA2BAD00E3D78FB3E03F96@cc-171.int.t-online.fr>

next in thread | previous in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--0-222696682-1117883805=:5262
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Sat, 4 Jun 2005, Mathieu Arnold wrote:

> +-le 04/06/2005 01:17 +1000, Tim Robbins =E9crivait :
> | 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 care=
s

Bruce
--0-222696682-1117883805=:5262--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050604205558.I5262>