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
35,147
24,005

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to