From owner-freebsd-chat Thu Sep 10 16:56:12 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA00932 for freebsd-chat-outgoing; Thu, 10 Sep 1998 16:56:12 -0700 (PDT) (envelope-from owner-freebsd-chat@FreeBSD.ORG) Received: from ifi.uio.no (ifi.uio.no [129.240.64.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA00924 for ; Thu, 10 Sep 1998 16:56:03 -0700 (PDT) (envelope-from dag-erli@ifi.uio.no) Received: from hrotti.ifi.uio.no (2602@hrotti.ifi.uio.no [129.240.64.15]) by ifi.uio.no (8.8.8/8.8.7/ifi0.2) with ESMTP id BAA23395; Fri, 11 Sep 1998 01:55:18 +0200 (MET DST) Received: (from dag-erli@localhost) by hrotti.ifi.uio.no ; Fri, 11 Sep 1998 01:55:17 +0200 (MET DST) Mime-Version: 1.0 To: Greg Lehey Cc: Wes Peters , "Jordan K. Hubbard" , freebsd-chat@FreeBSD.ORG Subject: Re: ed References: <9698.905291210@time.cdrom.com> <35F7CF17.E0C82BCA@softweyr.com> <19980911085119.L583@freebie.lemis.com> Organization: University of Oslo, Department of Informatics X-url: http://www.stud.ifi.uio.no/~dag-erli/ X-other-addresses: 'finger dag-erli@ifi.uio.no' for a list X-disclaimer-1: The views expressed in this article are mine alone, and do X-disclaimer-2: not necessarily coincide with those of any organisation or X-disclaimer-3: company with which I am or have been affiliated. X-Stop-Spam: http://www.cauce.org/ From: dag-erli@ifi.uio.no (Dag-Erling =?iso-8859-1?Q?Co=EFdan?= =?iso-8859-1?Q?Sm=F8rgrav?= ) Date: 11 Sep 1998 01:55:17 +0200 In-Reply-To: Greg Lehey's message of "Fri, 11 Sep 1998 08:51:19 +0930" Message-ID: Lines: 26 X-Mailer: Gnus v5.5/Emacs 19.34 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by hub.freebsd.org id QAA00927 Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Greg Lehey writes: > 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 Well, you forgot a few ' and $ here and there, it will barf at the first mv for want of a second argument, and it can be written more concisely (and more readably): for f in `find . \( -name '*.[ch]' -o -name Makefile \)` ; do sed 's/Good Time Engineering/Mega Baby Bell/g' "${f}" >"${f}.new" && mv "${f}.new" "${f}" && echo "edited ${f}" done Apart from that, nothing :) DES -- Dag-Erling Smørgrav - dag-erli@ifi.uio.no To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message