From owner-freebsd-questions Tue Jan 14 13:13:53 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id NAA07628 for questions-outgoing; Tue, 14 Jan 1997 13:13:53 -0800 (PST) Received: from horton.iaces.com (root@horton.iaces.com [204.147.87.98]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id NAA07619 for ; Tue, 14 Jan 1997 13:13:49 -0800 (PST) Received: (from proot@localhost) by horton.iaces.com (8.8.4/8.7.3) id PAA26456; Tue, 14 Jan 1997 15:13:40 -0600 (CST) From: "Paul T. Root" Message-Id: <199701142113.PAA26456@horton.iaces.com> Subject: Re: Search and Replace? To: bextreme@POBox.com Date: Tue, 14 Jan 1997 15:13:40 -0600 (CST) Cc: questions@FreeBSD.ORG In-Reply-To: <199701141956.LAA02307@mail.ptw.com> from Jesse at "Jan 14, 97 07:20:18 am" X-Organization: !nterprise Networking Services - ACES X-Phone: (612) 663-1979 X-Fax: (612) 663-8030 X-Page: (800) SKY-PAGE PIN: 537-7270 X-Address: 200 S. 5th St., Suite 1100 X-Address: Minneapolis, MN 55402 X-Mailer: ELM [version 2.4ME+ PL22 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk In a previous message, Jesse said: > Hello, sorry if this is not the correct list to give this to, but I > don't know of anywhere else to ask. > > I have a file that I need to replace a instance of a word with a > variable (for instance with the variable of the current IP > address) automatically. > > I would appreciate any help possible... Thanks!! Without starting a editor religious war. Vi: :1,$s/oldaddr/newaddr/g Command line using sed: sed s/oldaddr/newaddr/g oldfile >newfile You could also use emacs, perl, awk probably. Paul. -- Herbivores ate well cause their food didn't ever run. --Jonathan Fishman