Subject: Re: Single user mode: ed(1) or bust
To: Lasse Hiller?e Petersen <lhp@toft-hp.dk>
From: Andrew Reilly <andrew-netbsd@areilly.bpc-users.org>
List: netbsd-users
Date: 05/16/2007 14:12:07
On Sat, May 05, 2007 at 08:58:49AM +0200, Lasse Hiller?e Petersen wrote:
> Poor man's cat:
> while read l ; do echo $l ; done <filein >fileout
>
> Now, what is a good candidate for poor man's ed?
Not that I've ever tried to do this, but if your shell happened to be bash,
then you could re-phrase your cat as:
while read l; do echo ${l/pattern/substitute}; done <filein >fileout
to give you something like a sed. Unfortunately our shell can't do that, but
you might be able to get by on a case-by-case process with a combination of
line splitting and/or prefix/suffix substitution and counting (arithmetic
expansion).
Cheers,
--
Andrew