Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Jan 1997 15:13:40 -0600 (CST)
From:      "Paul T. Root" <proot@horton.iaces.com>
To:        bextreme@POBox.com
Cc:        questions@FreeBSD.ORG
Subject:   Re: Search and Replace?
Message-ID:  <199701142113.PAA26456@horton.iaces.com>
In-Reply-To: <199701141956.LAA02307@mail.ptw.com> from Jesse at "Jan 14, 97 07:20:18 am"

next in thread | previous in thread | raw e-mail | index | archive | help
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 <IP> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701142113.PAA26456>