3 ms·
But "sed -i'' s/../../ FILE" will work on both, no? Or -i.orig if you want to keep a backup file?
by arp242 3y ago
But "sed -i'' s/../../ FILE" will work on both, no? Or -i.orig if you want to keep a backup file?
- jorams 3y agoThat does not work on macOS. "-i''" is the same as just a bare "-i", and it will then interpret the next argument as the backup suffix.
- arp242 3y agoOops yes, that should have been -i '' with a space. But I see now that GNU doesn't accept -i '', or even -i .orig. It MUST be without a space: "-i.orig". The reason for that I assume is there's no way to disambiguate: echo foo | sed -i pattern echo foo | sed -i .orig But you can still use "-i.orig"; that should work on both. That will leave you with a .orig file to clean up, but arguably that's not a bad thing as -i can clobber files.
- deleted 3y ago[deleted]