On Mon, Sep 01, 2008, William L. Maltby wrote:
On Sun, 2008-08-31 at 19:45 +0200, Thomas Johansson wrote:
Hi
Perhaps omeone might answer this tricky problem. I can do this other ways, but i really want to understand how to solve it using ed. I have one solution using g/re/s/re//txt/ , but I want to understand how or if i can solve it using the ed (.)a command.
OK. But keep in mind that many folks (and distros?) believe ed is hopelessly outdated and some even advocate its removal from distributions. Thankfully some other packages(s) depend on it.
Instead of ``ed' one can use ``ex'' which should be in any distribution as its part of ``vi'' or ``vim''. I think the command set of ``ed'' is a subset of ``ex'' so scripts should work the same.
I frequently use the gnu shtool program for this sort of thing unless the job is very simple, and I really want to edit the file in place.
Bill