Please help me with writing a shell script that deletes line from virus JS files recursively.
String to remove: http://pastebin.com/ExjCK8GL
|
Please help me with writing a shell script that deletes line from virus JS files recursively. String to remove: http://pastebin.com/ExjCK8GL |
|||
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.
|
As mentioned, your question is a little vague so my response might not be the answer you're looking for. I'll make what I feel are reasonable assumptions and give it a go anyway. My assumptions: you have that "pastebin.com" string in a number of files and these files are scattered around in many different directories but under one main directory. Go to this main directory and run:
This command will strip out the line and create backup versions of each modified file with a ".bak" extension. Note: this command does not care if the line in question is something like:
The command above will omit any line that matches "http://pastebin.com/ExjCK8GL", regardless of where that string occurred in the line, either by itself or amongst other less virus-y strings. If you do want to match just the lines with that string and only that string, change the command to:
|
|||
|
|
find ./ -type f -exec sed -i ‘s/string1/string2/’ {} \;but I do not know how to escape such a large line in the regular expression. Sorry for my bad English. – Ticksy May 15 '12 at 16:47