12 ms·
I wasn't familiar with that "-r", but FWIW the gsed man page says "(for portability use POSIX -E)" Abutting that "r" option against the "i" option is likely wh
by mdaniel 5y ago
I wasn't familiar with that "-r", but FWIW the gsed man page says "(for portability use POSIX -E)"
Abutting that "r" option against the "i" option is likely why you ended up with a file named .txtr and therefore implies that it did not actually hear the "-r" you intended
I've had the best luck picking an actual backup suffix such as "-i.bak" or "-i~" to keep BSD sed and GNU sed on the same page, although I've also seen scripts that go as far as "--version" sniffing and changing the actual invocation as "${SED_I} -E" type stuff
- rossvor 5y agoYou are absolutely correct! I wasn't aware that "-i" takes an optional suffix, so it didn't even occur to me to look at the sed line as possible cause for this extension weirdness.
- mdaniel 5y agoYeah, but "optional" in the _worst possible way_ since, due to the getopt library difference, the GNU version wants any empty suffix value abutted, and the BSD version wants it separated away from the "-i", burning thousands of hours of humanity over the years :-( Woe unto those who write scripts as "sed -i -e /whatever/" since for half(?) of their users they'll end up with "somefile-e"