perl関連ワンライナー集

ファイル内の文字列を一斉置換

find . -type f -name '*.pm' -print0 | xargs -0 perl -i -pe 's/before/after/g'
文字コードの一斉置換。 それぞれEUC-JPとSJISからUTF-8 SJISは波ダッシュ問題回避のためにCP932で指定する。
find . -name '*.pm' | xargs nkf --ic=eucJP-ms --oc=UTF-8 --overwrite
find . -name '*.pm' | xargs nkf --ic=CP932 --oc=UTF-8 --overwrite
全てのpmファイルにperl -cをかける
find . "*.pm" -exec perl -c {} \;