We need a shell script to find and replace a piece of injected code within all index.php files within a /home folder
You can do it with sed. Here's a good tutorial about it. It may be as simple as
I suggest you to backup before doing that and running some tests to see if it works ok. Remember that the stuff between the / / are regular expressions and depending on its format you may end matching more stuff you need. As I said, test before running this on your 'live' files.
EDIT: fixed the find command, thanks rems
If you want to TEST it first, you may put it first in a temporary file, check if it's correct, and overwrite the original file afterwards:
Now go through some of your files and check if the replacement was done correctly. IF everything is ok, then rename the new index.php.tmp files to index.php with
If the code you want to replace has slashes ( "/" ) in it, then you can use another delimiter in the sed substitute command: 's# piece of code to find # replace with this #g'