Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 was marked as an exact duplicate of an existing question.

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

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