Comment on Hacking ls -lparentComments−taf213ythis 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.−sendos13yThe following modifies only the file size: ls -l | perl -pe 'while(s/^((\S+\s+){4})(\d+)(\d{3})([^\d].*)?$/$1$3,$4$5/){}'−dalke13yYes. 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
Comments
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.
The following modifies only the file size:
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:
With your perl one-liner on my directory I get mis-aligned columns: That's ugly. It should be: