Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Oct 1998 04:22:26 -0700
From:      Graeme Tait <graeme@echidna.com>
To:        flygt@sr.se
Cc:        Bill Hamilton <billh@finsco.com>, FreeBSD Questions <questions@FreeBSD.ORG>
Subject:   Re: alternate file listing
Message-ID:  <362C7272.4F41@echidna.com>
References:  <362B3923.2534A16A@graphnet.com> <362C58C1.B4D1367@pc.jaring.my> <362BB8A2.B27F615E@finsco.com> <19981020090701.A9920@sr.se>

next in thread | previous in thread | raw e-mail | index | archive | help
Gunnar Flygt wrote:
> 
> On Mon, Oct 19, 1998 at 05:09:38PM -0500, Bill Hamilton wrote:
> > like what directories?
> > ls -lR | sort -k 5
> > will sort on on size from "." down. (at least on Solaris)
> 
> That won't work well on neither FreeBSD nor Solaris. You get a sort, not
> in filesize order, but on the first, second and son on digigt. At least
> on the two different machines I checked.


Yes - the action of sort in this case seems to depend on the column alignment, 
which for ls -l depends in turn on the width of the user and group names. Within 
a single directory, with say constant group and user names, the sort is in 
numeric order. It's worse with ls -lR, as the column alignment can additionally 
change from directory to directory, depending on the maximum file size in each 
directory.


I found the sort man page rather confusing, but I believe from experiment that

ls -lR | sort -nk 5

does work (FreeBSD). The resulting listing can look rather ugly, though.


-- 
Graeme Tait - Echidna


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?362C7272.4F41>