Help to remove script data from file using grep & sed
On one of my servers, it appears that a bunch of html files got the following code added to it...
grep -lr -e 'apples' *.html | xargs sed -i 's/apples/oranges/g'
I can get the grep portion to work...
Any help would be appreciated... I will also make sure that the security right on that directory is changed - so this can't happen again.
I also added the /rtbn2/ address at the beginning, which, while not necessary, should make it a bit more efficient. Only lines containing that string will have the substitution command run on them.
Also have a look at the -i option for editing the files in place, with optional backup creation.
|All times are GMT -5. The time now is 06:08 PM.|