自己メモ。
pukiwikiにプログラム結果を張ろうとしたら、はてなのpre記法っぽいのもがなくて、空白を入れるとかだった。行数が長いので手で入れたくはない。というわけでワンライナー。
/Users/yasuhisa% perl -pe 's/^(.*)/ $1/' test.txt
似たようなやつ。
/Users/yasuhisa% perl -nle 'print " $1" if $_ =~ /(.*)/' test.txt
こんなののも。
/Users/yasuhisa% perl -i.bak -ple 's/^(.*)/ $1/' test.txt
やべ、間違ったと思ったらこれでアンドゥ。home directoryとかだと-maxdepth 1しとかないと大変になる。
/Users/yasuhisa% find . -type f -maxdepth 1 -name *.bak | perl -nle'$o=$_;s/\.bak$//;rename $o,$_'