Search and replace a string in a file