3 ms·
I prefer ed for so-called "in-place" editing, not "sed -i". I am always using tmpfs anyway and it makes little difference to me if I can see the temporary file
by 1vuio0pswjnm7 6y ago
I prefer ed for so-called "in-place" editing, not "sed -i". I am always using tmpfs anyway and it makes little difference to me if I can see the temporary file created or whether it is effectively hidden. Even NetBSD has added "-i" to sed now, and coreutils does not include ed. I do not see such moves as "progress" but that's just me.
If MacOS sed has "-a" then something like
sed -na 's/a/b/;H;$!d;g;w'file file
should approximate "-i" (but without a temp file). The catch is it will leave a blank line at the top.