From owner-freebsd-chat Thu Sep 10 16:21:34 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA23818 for freebsd-chat-outgoing; Thu, 10 Sep 1998 16:21:34 -0700 (PDT) (envelope-from owner-freebsd-chat@FreeBSD.ORG) Received: from allegro.lemis.com (allegro.lemis.com [192.109.197.134]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA23813 for ; Thu, 10 Sep 1998 16:21:30 -0700 (PDT) (envelope-from grog@freebie.lemis.com) Received: from freebie.lemis.com (freebie.lemis.com [192.109.197.137]) by allegro.lemis.com (8.9.1/8.9.0) with ESMTP id IAA02947; Fri, 11 Sep 1998 08:51:34 +0930 (CST) Received: (from grog@localhost) by freebie.lemis.com (8.9.1/8.9.0) id IAA13169; Fri, 11 Sep 1998 08:51:19 +0930 (CST) Message-ID: <19980911085119.L583@freebie.lemis.com> Date: Fri, 11 Sep 1998 08:51:19 +0930 From: Greg Lehey To: Wes Peters , "Jordan K. Hubbard" Cc: freebsd-chat@FreeBSD.ORG Subject: Re: ed References: <9698.905291210@time.cdrom.com> <35F7CF17.E0C82BCA@softweyr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.91.1i In-Reply-To: <35F7CF17.E0C82BCA@softweyr.com>; from Wes Peters on Thu, Sep 10, 1998 at 07:07:35AM -0600 WWW-Home-Page: http://www.lemis.com/~grog Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-41-739-7062 Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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 < 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.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