Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This question already has an answer here:

Server got hacked and a fair amount of files were edited. We noticed that the code that was inserted were typically done between delimiters (e.g. /*e21234*/ blah blah /*/e21234*/). What is the most efficient way to remove this from a large number of files on a linux box? (I tried using sed but couldn't quite get it. I'm open to using perl or whatever would work)

share|improve this question

marked as duplicate by Tom O'Connor, Ladadadada, mgorven, Khaled, Bryan Mar 1 '13 at 19:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

1 Answer

Did you try this:

sed 's,/\*e21234\*/.*e21234\*/,,g'

But I agree that restoring a backup is probably best!

share|improve this answer
    
This won't handle stuff spanning lines (in sed, '.' doesn't match newline). Perhaps sed -r -e 's,/\*e2134\*/(.|\n)*/.*e21234\*/,,g' helps. In any case, you won't ever be sure you got rid of all of it. –  vonbrand Mar 2 '13 at 2:49
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.