Date: Fri, 11 Sep 1998 09:44:45 +0930 From: Greg Lehey <grog@lemis.com> To: =?iso-8859-1?Q?Dag-Erling_Co=EFdanSm=F8rgrav?= <dag-erli@ifi.uio.no> Cc: Wes Peters <wes@softweyr.com>, "Jordan K. Hubbard" <jkh@time.cdrom.com>, freebsd-chat@FreeBSD.ORG Subject: Re: ed Message-ID: <19980911094445.X583@freebie.lemis.com> In-Reply-To: =?iso-8859-1?Q?=3Cxzp67evfrq2=2Efsf=40hrotti=2Eifi=2Euio=2Eno=3E=3B_from?= =?iso-8859-1?Q?_Dag-Erling_Co=EFdanSm=F8rgrav__on_Fri=2C_Sep_11=2C_1998_?= =?iso-8859-1?Q?at_01:55:17AM_%2B0200?= References: <9698.905291210@time.cdrom.com> <35F7CF17.E0C82BCA@softweyr.com> <19980911085119.L583@freebie.lemis.com> <xzp67evfrq2.fsf@hrotti.ifi.uio.no>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, 11 September 1998 at 1:55:17 +0200, Dag-Erling CoïdanSmørgrav wrote:
> Greg Lehey <grog@lemis.com> writes:
>> 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
>
> Well, you forgot a few ' and $ here and there, it will barf at the
> first mv for want of a second argument,
Guess who wrote in a hurry and didn't test :-(
But where did I miss a '? Bill's missed ' doesn't count.
> 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
Style considerations.
> Apart from that, nothing :)
I'm glad to see you accept it :-)
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?19980911094445.X583>
