Date: Fri, 11 Sep 1998 08:51:19 +0930 From: Greg Lehey <grog@lemis.com> To: Wes Peters <wes@softweyr.com>, "Jordan K. Hubbard" <jkh@time.cdrom.com> Cc: freebsd-chat@FreeBSD.ORG Subject: Re: ed Message-ID: <19980911085119.L583@freebie.lemis.com> In-Reply-To: <35F7CF17.E0C82BCA@softweyr.com>; from Wes Peters on Thu, Sep 10, 1998 at 07:07:35AM -0600 References: <9698.905291210@time.cdrom.com> <35F7CF17.E0C82BCA@softweyr.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday, 10 September 1998 at 7:07:35 -0600, Wes Peters wrote: > Jordan K. Hubbard wrote: >> >>> Ugh. I wouldn't go so far as to say it's a favorite, but I still use >>> it for quick editing tasks where you need to change one string to >>> another, and in shell scripts. >> >> Actually, I wasn't really joking, and though it's certainly true that >> I use ed pretty rarely (usually when I'm in a situation where my >> terminal settings or current emulator are too braindead for vi), I >> still really like it for its concise-yet-powerful approach to editing. >> >> The problem most people have with ed(1) is that they don't have enough >> context to compare it to OTHER line editors, something which I >> unfortunately have in spades. > > Yeah, me too. Those who think ed is bad should try, for instance, > that horrid editor that came with CP/M, ED, the father of EDLIN? Right, it was emetic. > or "sos" on TOPS-10. Or, as an example of something other > FreeBSD'ers MAY have seen, edlin. Remember that barfluous little > botch? I took a look at the source when I got my first version of 86/DOS, confirmed that it was warmed-over (CP/M) ED, and went back to MINCE. >> Those who started with vi and then perhaps went on to emacs just have >> no perspective on what something like ed(1) represents. :-) > > It was and is probably the best line editor ever written. > > Driving home last night I recalled a recent use of ed, one that is too > common in my life. About every 14 months lately I change jobs, usually > because my employer has been bought by someone and the whole management > structure and tempo changes. Since I'm usually the "Alpha Geek" at > work, I usually get the ugly job of changing the company name in all > the comment headers, startup prompts, etc. > > for file in `find . \( -name '*.[ch] -o -name Makefile \) -print` > do > ed $file <<EOF > 1,$s/Good Time Engineering/Mega Baby Bell/g > w > q > EOF > echo $file edited. > done > > You type this in, and depending on the size of your product(s), leave > for lunch or the night. When you get back, all of your source files > have been updated (to the rear, it seems) and you can quietly find a > new job. ;^) So what's wrong with for file in `find . \( -name '*.[ch] -o -name Makefile \) -print` do sed <file >file.new 's/Good Time Engineering/Mega Baby Bell/g' if [ $? -eq 0 ]; then mv file.new fi echo $file edited. done ? Greg -- See complete headers for address, home page and phone numbers finger grog@lemis.com for PGP public key To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980911085119.L583>