I answered to first replacement of a string in a file using sed and it was marked as possible duplicate. Then I looked at How to use sed to replace only the first occurrence in a file? (the original question) and thought that my answer can be helpful there, even though the question has an already accepted answer. Should I copy my answer to the original question? Would it be better to wait the possible duplicate to be closed?

  • 4
    By the way, the other way round (copying an answer from the original question to the duplicate) is a no-go. But the original question should always be enhanced. – Time Traveling Bobby May 27 '11 at 14:41

If your answer is valid for the original, I would copy it as well. Maybe it's better than the accepted one. Closed question does not have the answers migrated.

  • What do you mean? Answers on closed questions aren't migrated anywhere. – Adam Lear May 27 '11 at 15:45
  • ooops.. I meant doesn't of course. Too fast typing. – M'vy May 27 '11 at 15:46

Rather than simply copying the answer, I would rather rephrase it and, if possible, add some more details. This is what I would do also in the case there are two questions to which I could answer with the same answer, even in the case the answer adds details that are not necessary for the second question.

  • Sure, I'd rather change some bits in the question. In this case, for example, I'd change the example used since it is closely related to the duplicate question. However, since the question may be a duplicate, maybe I do not have to change much more than this. – brandizzi May 27 '11 at 15:27
  • @brandizzi I would change it also in that case, just to avoid to make the answer a copy-and-paste. It's how I would do; I am not saying that because I do it, everybody must do it. – kiamlaluno May 27 '11 at 15:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .