Use ed instead of sed to work this on both Mac OS and Linux.