Use perl for inplace editing, as no combination of sed arguments allows it. See http://stackoverflow.com/questions/5694228/sed-in-place-flag-that-works-both-on-mac-and-linux. The shell option is even worse.