Sorry; my explanation above is not correct.
What I meant to say is that to edit a file in place WITHOUT CREATING a backup
file, BSD sed’s -i option requires a zero-length string as a mandatory
argument, while Gnu sed’s -i option does not take any argument. If a backup
file is wanted, then the
MacOS uses BSD sed. When the -i option to sed is used, it has a mandatory
argument, which should be a zero length string to edit the file in-place.
Gnu sed’s -i option uses an optional argument, rather than a mandatory
argument, which if not present allows the file to be edited in-place. Add
This problem is discussed in #3; sorry.
The error is caused by MacOS using BSD sed, which requires a mandatory argument
of a zero-length string to the -i option to edit a file in-place, whereas Gnu
sed has an optional argument to the -i option to edit a file in-place.
The different syntax