Discussion:
how to delete all occur of a character
shawn bright
2007-04-09 13:00:43 UTC
Permalink
lo there,

i have a file ( actually a group of them ) and i need to delete the
quotation marks in each file, i am sure that vim has a tool for this.

sk
Przemyslaw Gawronski
2007-04-09 13:27:57 UTC
Permalink
Hi
Post by shawn bright
i have a file ( actually a group of them ) and i need to delete the
quotation marks in each file, i am sure that vim has a tool for this.
vim file1 file2 ....

:argdo %s/\"//g<CR>
:xa<CR>

Przemek
--
AIKIDO TANREN DOJO - Poland - Warsaw - Mokotow - Ursynow - Natolin
info: http://www.tanren.pl/ phone: +48501516666 email: ***@tanren.pl
Przemyslaw Gawronski
2007-04-09 13:30:21 UTC
Permalink
Post by Przemyslaw Gawronski
vim file1 file2 ....
:argdo %s/\"//g<CR>
:xa<CR>
Well, better do it this way:

:argdo %s/\"//g | update<CR>

Then vim will write only if there were any changes in the file.

Przemek
--
AIKIDO TANREN DOJO - Poland - Warsaw - Mokotow - Ursynow - Natolin
info: http://www.tanren.pl/ phone: +48501516666 email: ***@tanren.pl
Jean-Rene David
2007-04-09 13:48:03 UTC
Permalink
Post by Przemyslaw Gawronski
:argdo %s/\"//g | update<CR>
" is not special, so no need to quote it.

:argdo %s/"//g | update<CR>
--
JR
Tim Chase
2007-04-09 15:30:20 UTC
Permalink
Post by shawn bright
i have a file ( actually a group of them ) and i need to
delete the quotation marks in each file, i am sure that vim
has a tool for this.
For a single file, you want to use

:%s/"//g

For multiple files, you might want:

:set hidden
:argdo %s/"//g
(review your changes)
:wall

(to write all the changes).

If they're funky "windows" quotes, you may have to copy&paste
them, perhaps using control-R followed by whichever register
holds the copied quote (either an asterisk/plus-sign for the
system clipboard, or the double-quote register).

You can read more at

:help :s
:help i_CTRL-R
:help registers


Hope this helps,

-tim
shawn bright
2007-04-09 15:48:13 UTC
Permalink
hey there, thanks for your tips, works great.
sk
Post by Tim Chase
Post by shawn bright
i have a file ( actually a group of them ) and i need to
delete the quotation marks in each file, i am sure that vim
has a tool for this.
For a single file, you want to use
:%s/"//g
:set hidden
:argdo %s/"//g
(review your changes)
:wall
(to write all the changes).
If they're funky "windows" quotes, you may have to copy&paste
them, perhaps using control-R followed by whichever register
holds the copied quote (either an asterisk/plus-sign for the
system clipboard, or the double-quote register).
You can read more at
:help :s
:help i_CTRL-R
:help registers
Hope this helps,
-tim
Loading...