Re: VIM
On Wed, Sep 19, 2001 at 01:40:17PM +1000, Craig Sanders wrote:
> 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.
>
- just for information there is also a small tool that is very useful
in that case, named replace, being a part of msql2mysql but widely
usable.
(it's included in mysql-server debian package)
hth
mose
--
< mose > < Makina Corpus > < 105, avenue Parmentier >
< http://makina-corpus.com > < FR 75011 PARIS >
< P: +33 (0) 1 53 36 18 59 > < F: +33 (0) 1 40 21 03 39 >
Reply to:
- References:
- VIM
- From: "Craig" <craigsc@zdata.co.za>
- Re: VIM
- From: Jesse Goerz <jgoerz@bellsouth.net>
- Re: VIM
- From: Craig Sanders <cas@taz.net.au>