カレントディレクトリー配下の*.phpなファイルの文字列を一括置換するワンライナー

ということで、new Diggin_Scraper_Processと記述していたところをnew Diggin_Scraperと変更する必要があります。適当にやるならこうでしょうか。*1

php -r 'class ExtFilter extends FilterIterator{function __construct(Iterator $i){parent::__construct($i);} function accept(){if(substr($this->current()->getRealpath(), -4) === ".php"){$r = preg_replace("/Diggin_Scraper_Process/", "Diggin_Scraper",file_get_contents($this->current())); file_put_contents($this->current(), $r);return true;} else {return false;}}}$r = new ExtFilter(new RecursiveIteratorIterator(new RecursiveDirectoryIterator(".")));foreach($r as $a)echo $a, PHP_EOL;';

あわせて読みたい
カレントディレクトリー配下の*.phpなファイルの文字エンコードをShift_JISからUTF-8に変換するワンライナー
Autoloading ZF and Zym

*1:windows使ってたら私ならdevas使います。http://www.vector.co.jp/soft/win95/util/se162621.html