On Mon, 2008-09-01 at 10:26 -0700, Bill Campbell wrote: > 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. > ><snip> > 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. Further, it *may* be that the "superset" that is available in ex can overcome of few of the deficiencies and hurdles that his use of ed is presenting. Because of my background, I never read about or learned the full ex stuff - vi(m), sed, (g)awk, bash, ... all did what I needed. Maybe if the OP reviews the ex stuff he'll have an easier time of it. Only potential downside I see is maybe a little more overhead and the need for vi(m)/ex on the target system. *Usually* they are there, but maybe someone is a "minimalist" there? > > 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 -- Bill (the other one)