Warning: Some posts on this platform may contain adult material intended for mature audiences only. Viewer discretion is advised. By clicking ‘Continue’, you confirm that you are 18 years or older and consent to viewing explicit content.
Another nice thing about ed is that it is sometimes easier to use than sed when you want to edit a file programmatically, since you can navigate lines at random (forward and backward directions), and you can still run regex find/replace like with sed. Just
printf 'i\nstring of ed commands\n.\n' | ed file-to-edit.txt
and pipe the commands into ed, although it is really an esoteric way to write scripts.
Another nice thing about ed is that it is sometimes easier to use than sed when you want to edit a file programmatically, since you can navigate lines at random (forward and backward directions), and you can still run regex find/replace like with sed. Just
and pipe the commands into ed, although it is really an esoteric way to write scripts.