4 ms·
sed -i '' .... is compatible with both. It's not a big deal.
by sacnoradhq 4y ago
sed -i '' .... is compatible with both. It's not a big deal.
- asicsp 4y agoDoesn't work with `GNU sed`: $ sed -i '' 's/foo/FOO/' ip.txt sed: can't read s/foo/FOO/: No such file or directory See also: https://stackoverflow.com/questions/5694228/sed-in-place-flag-that-works-both-on-mac-bsd-and-linux https://stackoverflow.com/questions/5694228/sed-in-place-fla...
- tempodox 4y agoBut this works: $ sed -e 's/foo/FOO/' -i 'ip.txt'
- asicsp 4y agoThat's same as `sed -i 's/foo/FOO/' ip.txt` on GNU sed. Question is about inplace editing command that works on both GNU and MacOS (without needing a backup, with backup `-i.bkp` works on both). I don't have a Mac to check if `sed -e 's/foo/FOO/' -i 'ip.txt'` works there.
- tempodox 4y agoI checked, it doesn't. I see your point.