From owner-cvs-all@FreeBSD.ORG Sat Jun 4 10:26:31 2005 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AC86316A41C; Sat, 4 Jun 2005 10:26:31 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailout2.pacific.net.au (mailout2.pacific.net.au [61.8.0.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2FDD243D49; Sat, 4 Jun 2005 10:26:31 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86]) by mailout2.pacific.net.au (8.12.3/8.12.3/Debian-7.1) with ESMTP id j54AQTkG007228; Sat, 4 Jun 2005 20:26:29 +1000 Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailproxy1.pacific.net.au (8.12.3/8.12.3/Debian-7.1) with ESMTP id j54AQRAT015704; Sat, 4 Jun 2005 20:26:28 +1000 Date: Sat, 4 Jun 2005 20:26:28 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Tim Robbins In-Reply-To: <20050603151728.GA77595@cat.robbins.dropbear.id.au> Message-ID: <20050604193714.G5749@delplex.bde.org> References: <200506031105.j53B5xBv040850@repoman.freebsd.org> <20050603151728.GA77595@cat.robbins.dropbear.id.au> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org, Dima Dorfman Subject: Re: cvs commit: src/bin/ls cmp.c extern.h ls.1 ls.c util.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2005 10:26:31 -0000 On Sat, 4 Jun 2005, Tim Robbins wrote: > 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? It doesn't violate filtering phillosophy and doesn't fail for ls -lh| (or ls| or ls -C). -h (human-unreadable) output is fairly machine-unreadable too. Machines can easily parse it, but sort -n doesn't. The formats accepted by sort -n are undocumented in sort.1. According to sort.c, they seem to be only human readable ones (floating point "f" formats plus ones with thousands separators but no exponentials) and the precision of the precision of the numbers is unlimited). According to POSIX, they are supposed be these with with an optional radix character but no exponentials. POSIX doesn't seem to document what a radix character is except for printf() etc., and doesn't seem to documented the required precision. Gnu sort also has a -g option which causes sorting of numbers in formats understood by strtod(2), so sort -g understands normal human-unreable exponential formats but not the ones produced by -h. Bruce