Re: VIM
On Tue, Sep 18, 2001 at 06:53:00AM -0400, Jesse Goerz wrote:
> On Tuesday 18 September 2001 04:38, Craig wrote:
> > Need to do an extended find and replace with VIM, anyone
> > know the syntax for me ? I have a really long named.conf
> > file I need to modify ...
>
> sed -e 's/what_to_find/replace_it_with_this/g' named.conf
>
> By default it sends all the output to stdout. You can redirect
> it to another file. It does multi-line as well. Try info sed
> or Google it. Very cool program.
try this instead:
perl -p -i -e 's/find/replace/g' file1 file2 file3 ... fileN
no need to mess around with temporary files, or stdout - perl edits
the file(s) in-place with the -i argument.
it can optionally make a backup copy of the file(s) before editing them.
use e.g. "-i.bak" for that.
craig
--
craig sanders <cas@taz.net.au>
Fabricati Diem, PVNC.
-- motto of the Ankh-Morpork City Watch
Reply to:
- References:
- VIM
- From: "Craig" <craigsc@zdata.co.za>
- Re: VIM
- From: Jesse Goerz <jgoerz@bellsouth.net>