3 ms·
> Or sed After learning how to use ed in scripts, I've found it's actually easier to use it compared to sed because it effectively has random access through th
by u801e 5y ago
> Or sed
After learning how to use ed in scripts, I've found it's actually easier to use it compared to sed because it effectively has random access through the input rather than going from beginning to end.
But both awk and Perl have the advantage of storing values in variables over sed or ed.
- Koshkin 5y agosed, being a stream editor, is more efficient than ed, in that it does not need to keep the entire file in memory.
- u801e 5y agoTrue, but if the file isn't that big, then the difference isn't noticable. Being able to do something like /some string/-2 d Which deletes a line 2 lines above where some string matched is something that's trivial to do in ed, but takes a bit of work in sed.