I looked at extracting something from inreplace, but it's not easy to make it reusable. I think it would be simpler to just do it inline, like:

```rb
File.open(pcfile, 'rb') do |f|
  s = f.read
  s.gsub!(%r[([\S]+)="?#{old_cellar}(.*?)"?$], "\\1=\"#{new_cellar}\\2\"")
  s.gsub!(%r[([\S]+)="?#{old_prefix}(.*?)"?$], "\\1=\"#{new_prefix}\\2\"")
  f.reopen(pcfile, 'wb')
  f.write(s)
end
```

This is essentially what inreplace does, but without the noise.