On Mon, Dec 12, 2022, at 15:27, Craig Sanders via luv-main wrote: > If you want to do an actual in-place edit (with edits being performed on the > same file with the same inode), you could something like the ancient (but > still useful) ed or ex. ed is the original unix text line editor, dating > back to 1969 and still included with modern unix & linux systems. ex is ...
I too will put in a good word for good old ed. I wrote most of my Ph.D. thesis using ed through a dial-up acoustic modem, but that was a long time ago. Since then, I've used it for system rescue when no other editor was available. And before ssh-keygen got the -R option, ed was the quickest and most convenient way to remove offending host lines from my ssh known_hosts file by something like: ed ~/.ssh/known_hosts 140d wq That is, delete line 140, write and quit. In-place editors normally have to slurp up the entire file into (virtual) main memory (or do some similar trick using temp files). I was a bit worried that ed's internal data structures might break on too big a file, but I was able to slurp up an approximately 4GB file: athena(ljk) time ed /tmp/foo.foo 4248829952 q real 4m44.176s user 1m0.899s sys 0m18.682s This was on an x86_64 machine. You might run into problems with a smaller word size. — Smiles, Les. _______________________________________________ luv-main mailing list -- [email protected] To unsubscribe send an email to [email protected]
