How to overwrite and save files with sed command

Tadashi Shigeoka ·  Tue, September 6, 2016

I researched how to overwrite and save files with the sed command, so here’s a personal memo.

Overwrite and save with -i option

sed -i -e '1d' input.txt

Overwrite and save using redirect >

sed -e '1d' input.txt > output.txt
cp output.txt input.txt

Obviously, sed -i is more convenient.

That’s all from the Gemba.