Rewrite file.sed_contains to run its own sed command

Fixes #4425
Fixes #3342

file.sed automatically adds the -i flag, which makes sed not print as
expected, breaking our contains check. It makes more sense to run
our own sed command here than to add a new flag to file.sed just for
whenn we call it from file.sed_contains