bate's blog

調べたこと実装したことなどを取りとめもなく書きます。

ls -lをセパレータ(カンマ,)で5個のフィールドにする

ls -l | sed -e "s/  */,/g" | perl -e 'while(<>){$s=$_;$c=($s=~s/,//g);\
chomp($_);for($i=0;$i<5-$c;$i++){$_=$_.","}print $_."\n";}'