So I used this to find all files in /directory that contain a code "test"
grep -R “test” /directory
Now I want to delete that code found in all the files in /directory at once.
Just that line of code for each file it is detected in.
UPDATE ***
I want to remove injected code @require(dirname(__FILE__).'/php/malware.php');
So this was done but it doesnt work. No error message shows. It just accepts the command.
grep -l -R '@require(dirname(__FILE__).'/php/malware.php');' /directory | xargs -I {} sed -i.bak 's/@require(dirname(__FILE__).'/php/malware.php');//g' {}