#!/bin/bash
# <http://feedproxy.google.com/~r/Command-line-fu/~3/myQ3yqLE4ec/insert-commas-to-make-reading-numbers-easier-in-the-output-of-ls>
# This modifies the output of ls so that the file size has commas every three digits.
# It makes room for the commas by destructively eating any characters to the left of the size,
# which is probably okay since that's just the "group".
# Note that I did not write this, I merely cleaned it up and shortened it with extended regular expressions.
# The original shell script, entitled "sl", came with this description:
#  : For tired eyes (sigh), do an ls -lF plus whatever other flags you give
#  : but expand the file size with commas every 3 digits. Really helps me
#  : distinguish megabytes from hundreds of kbytes...
#  :
#  : Corey Satten, corey@cac.washington.edu, 11/8/89

/bin/ls -lF "$@" | sed -r ': top; s/. ([0-9]+)([0-9]{3}[,0-9]* \w{3} )/ \1,\2/ ; t top'


syntax highlighted by Code2HTML, v. 0.9.1