Search code examples
linuxsecurityservermalware

Delete or replace first line of 3500 php files


I have an old server, all php files are compromised by a malicious code on the first line of all files. I would replace the first line by a simple line that contains <?php

could you advise me a linux command for doing this ?

thank you


Solution

  • I write this :

        grep 'create_";global' -rl | xargs sed '1 s/^.*$/<?php/g' -i
    

    and I think it doing the job