News for hackers. Stuff that matters.
Re:Hacking ls -l by taf2 on Saturday October 13, 2012 @07:36PM (#4650102)
this should fix that. ls -l | sed -e :a -e 's/\s\(.*[0-9]\)\([0-9]\{3\}\) /\1,\2 /;ta'

correction: sorry it will only fix the modifications to the filename - the year is still broken.

Re:Hacking ls -l by sendos on Sunday October 14, 2012 @02:50AM (#4650869)
The following modifies only the file size:

  ls -l | perl -pe 'while(s/^((\S+\s+){4})(\d+)(\d{3})([^\d].*)?$/$1$3,$4$5/){}'
Re:Hacking ls -l by dalke on Sunday October 14, 2012 @06:52AM (#4651181)
Yes. So long as you only want to modify ls -l. And don't care about column alignment. The original author wants output to look like:

    -rw-r--r--  1 root  wheel  16,596,907,252 24 Dec  2009 boskoop.disk0.bz2 
    -rw-r--r--  1 grog  wheel   4,173,914,809 20 Jul  2006 boskopp.tar.gz 
With your perl one-liner on my directory I get mis-aligned columns:

    -rw-r--r--     1 dalke  staff  3,236,397,056 Sep 13  2011 pubchem.fps
    -rw-r--r--     1 dalke  staff   712,181,172 Sep 13  2011 pubchem.fps.gz
That's ugly. It should be:

    -rw-r--r--     1 dalke  staff  3,236,397,056 Sep 13  2011 pubchem.fps
    -rw-r--r--     1 dalke  staff    712,181,172 Sep 13  2011 pubchem.fps.gz