4 ms·
There are advantages to having overwrite-in-place as an option. If sed is passed a malformed expression, or for whatever reason is unable to operate, the file i
by philh 17y ago
There are advantages to having overwrite-in-place as an option. If sed is passed a malformed expression, or for whatever reason is unable to operate, the file is untouched. A separate program would clobber it.
Better to have the separate program than everything to implement its own version, but having both isn't necessarily bad.
- silentbicycle 17y ago> A separate program would clobber it. Nope, you can check the return value from the program(s) run inside of it and revert to the backup file if there's a problem. You really don't need it to be handled specifically by sed. There's actually an example script that does exactly that in _The Unix Programming Environment_, called 'overwrite', on page 154.
- deleted 17y ago[deleted]