PHP脚本删除许多文件中的部分代码

A client of us has a site that apparently has been a victim of some sort of malware attack. After a scan we found that many (1000+) files are injected with a piece of PHP code starting on each of these files. I'd like to create a script that automatically removes all these code pieces.

The code that is added starts with:

<?php $qwilcq = then a bunch of code

?>

Then the normal php code starts. Is there an easy way of creating such a script or is it even possible?