How to use ed - the original text editor
Posted on Fri 03 January 2025 in tech • Tagged with ed, unix
How to use ed
ed file.txt
1,$p # Print all lines.
3d # Delete line 3.
$s/foo/bar/g # Replace "foo" with "bar" in all lines.
w # Save changes.
q # Quit the editor.
i # insert previous line
a # append next line