Use the `inreplace` function. Has this been submitted upstream?