bambooflow Note

カレントディレクトリ以下のファイル内文字列を一括置換

最終更新:

bambooflow

- view
メンバー限定 登録/ログイン

カレントディレクトリ以下のファイル中文字列を一括置換



find+perlで


  • 一括置換
$ find . -type f -name '*.html' -print0 | xargs -0 perl -i.bak -pe 's/from/to/g'

  • 変換がうまくいったらバックアップファイルを削除
$ find . -type f -name '*.php.bak' -print0 | xargs -0 rm -rf
記事メニュー
ウィキ募集バナー