emacs grep-edit allows to edit the text in the *grep* buffer, and to apply the changes to the file.