[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: suggestion for 'ls' coreutil, comma'd filesizes in -l output

From: Eric Blake
Subject: Re: suggestion for 'ls' coreutil, comma'd filesizes in -l output
Date: Tue, 04 Jun 2013 12:01:42 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6

On 06/04/2013 11:23 AM, smu johnson wrote:
> Dear coreutils email maintainer,
> I have a suggestion for 'ls'.  My idea is a GNU extension switch which
> commafies (for lack of a better word) the filesizes in the basic -l output
> of integers.  This has been the default for 'dir' since MS-DOS, but I think
> it might be a good addition for an optional switch in 'ls', in which case
> i'd "enable it" by making / modifying my alias for 'ls'.
> Right now I use a frontend for 'ls' written in Perl to do the same job, but
> as you can probably guess, the solution is a bit cludgey and likely prone
> to fail down the road.  But right now, its output is:
> sjohnson@web1:/tmp/sjohnson$ ls -l test*
> -rw-r--r-- 1 sjohnson sjohnson    13,824 2012-12-10 13:32 test1.txt
> -rw-r--r-- 1 sjohnson sjohnson     9,973 2012-12-10 12:13 test.bin
> -rw-r--r-- 1 sjohnson sjohnson        71 2013-04-10 17:49 test.txt
> Any thoughts or comments greatly appreciated.  Thank you for reading.

More generically, if we had a --format argument that allowed you to use
% tokens for all elements to be listed, then you can use a printf-style
' modifier in the element that lists file size, as well as any other
tweak you want to make in the line layout.

In fact, stat already has that:

$ stat -c "%'s" COPYING HACKING

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]