replace

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

replace

Cliff Oliveira
I would like to find and replace at once a word within multiple directories from a project, MacVim offers this possibility?

--
 Cliff Oliveira
www.tribodeideias.com.br

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: replace

David Henderson

On 31 Aug 2011, at 07:04, Cliff Oliveira wrote:

I would like to find and replace at once a word within multiple directories from a project, MacVim offers this possibility?

See help for vimgrep, args, and argsdo 


David P Henderson
--
"Beautiful bodies and beautiful personalities rarely go together."
    -- Carl Jung

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: replace

Kyle Lippincott-2
Keep in mind also that Mac OS X is UNIX, and you can use :! in vim to shell out, so something like:
:!find project/directory -name '*.cc' | xargs sed -i 's/original/replacement/'

Depending on how many files there are, this may be much faster than args/argdo.

On Wed, Aug 31, 2011 at 8:06 AM, David Patrick Henderson <[hidden email]> wrote:

On 31 Aug 2011, at 07:04, Cliff Oliveira wrote:

I would like to find and replace at once a word within multiple directories from a project, MacVim offers this possibility?

See help for vimgrep, args, and argsdo 


David P Henderson
--
"Beautiful bodies and beautiful personalities rarely go together."
    -- Carl Jung

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: replace

Kyle Lippincott-2
err...  you might need to escape the | in that, vim has its own uses for it (I can't remember if after :! it's *not* treated specially).  It's probably easier to just open a terminal and do it there.

On Wed, Aug 31, 2011 at 11:26 AM, Kyle Lippincott <[hidden email]> wrote:
Keep in mind also that Mac OS X is UNIX, and you can use :! in vim to shell out, so something like:
:!find project/directory -name '*.cc' | xargs sed -i 's/original/replacement/'

Depending on how many files there are, this may be much faster than args/argdo.


On Wed, Aug 31, 2011 at 8:06 AM, David Patrick Henderson <[hidden email]> wrote:

On 31 Aug 2011, at 07:04, Cliff Oliveira wrote:

I would like to find and replace at once a word within multiple directories from a project, MacVim offers this possibility?

See help for vimgrep, args, and argsdo 


David P Henderson
--
"Beautiful bodies and beautiful personalities rarely go together."
    -- Carl Jung

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: replace

Cliff Oliveira
In reply to this post by David Henderson
I managed to locate the files using:! grep but how to replace the word being searched?

I used

:!grep sistema. ~/workspace/canto/*



2011/8/31 David Patrick Henderson <[hidden email]>

On 31 Aug 2011, at 07:04, Cliff Oliveira wrote:

I would like to find and replace at once a word within multiple directories from a project, MacVim offers this possibility?

See help for vimgrep, args, and argsdo 


David P Henderson
--
"Beautiful bodies and beautiful personalities rarely go together."
    -- Carl Jung

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php



--
 Cliff Oliveira
www.tribodeideias.com.br

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: replace

Kyle Lippincott-2
This only does all of the files in one directory, is that what you intended?  If so:
:!sed -i 's/sistema./replacement/' ~/workspace/canto/*
should work.  http://en.wikipedia.org/wiki/Sed is the wikipedia page for sed, and there are many many tutorials out there on how to use it :)

On Wed, Aug 31, 2011 at 1:39 PM, Cliff Oliveira <[hidden email]> wrote:
I managed to locate the files using:! grep but how to replace the word being searched?

I used

:!grep sistema. ~/workspace/canto/*




2011/8/31 David Patrick Henderson <[hidden email]>

On 31 Aug 2011, at 07:04, Cliff Oliveira wrote:

I would like to find and replace at once a word within multiple directories from a project, MacVim offers this possibility?

See help for vimgrep, args, and argsdo 


David P Henderson
--
"Beautiful bodies and beautiful personalities rarely go together."
    -- Carl Jung

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php



--
 Cliff Oliveira
www.tribodeideias.com.br

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: replace

Cliff Oliveira
I tried the tip but sent it returned following error:

:!sed -i 's/sistema./www./' ~/workspace/canto/*
[No write since last change]
sed: 1: "/Users/cliffoliveira/wo ...": command c expects \ followed by text

I tried to put \ at the end but did not work



2011/8/31 Kyle Lippincott <[hidden email]>
This only does all of the files in one directory, is that what you intended?  If so:
:!sed -i 's/sistema./replacement/' ~/workspace/canto/*
should work.  http://en.wikipedia.org/wiki/Sed is the wikipedia page for sed, and there are many many tutorials out there on how to use it :)

On Wed, Aug 31, 2011 at 1:39 PM, Cliff Oliveira <[hidden email]> wrote:
I managed to locate the files using:! grep but how to replace the word being searched?

I used

:!grep sistema. ~/workspace/canto/*




2011/8/31 David Patrick Henderson <[hidden email]>

On 31 Aug 2011, at 07:04, Cliff Oliveira wrote:

I would like to find and replace at once a word within multiple directories from a project, MacVim offers this possibility?

See help for vimgrep, args, and argsdo 


David P Henderson
--
"Beautiful bodies and beautiful personalities rarely go together."
    -- Carl Jung

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php



--
 Cliff Oliveira
www.tribodeideias.com.br

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php



--
 Cliff Oliveira
www.tribodeideias.com.br

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: replace

Kyle Lippincott
Doh. I forgot that -i takes an argument.  Does sed -i -e 's/sistema./www./' ~cliffoliveira/workspace/canto/* work?

I keep responding from my iPhone, so I can't really check if the command I'm giving has the correct syntax. :(

On Sep 1, 2011, at 3:23, Cliff Oliveira <[hidden email]> wrote:

I tried the tip but sent it returned following error:

:!sed -i 's/sistema./www./' ~/workspace/canto/*
[No write since last change]
sed: 1: "/Users/cliffoliveira/wo ...": command c expects \ followed by text

I tried to put \ at the end but did not work



2011/8/31 Kyle Lippincott <[hidden email]>
This only does all of the files in one directory, is that what you intended?  If so:
:!sed -i 's/sistema./replacement/' ~/workspace/canto/*
should work.  http://en.wikipedia.org/wiki/Sed is the wikipedia page for sed, and there are many many tutorials out there on how to use it :)

On Wed, Aug 31, 2011 at 1:39 PM, Cliff Oliveira <[hidden email]> wrote:
I managed to locate the files using:! grep but how to replace the word being searched?

I used

:!grep sistema. ~/workspace/canto/*




2011/8/31 David Patrick Henderson <[hidden email]>

On 31 Aug 2011, at 07:04, Cliff Oliveira wrote:

I would like to find and replace at once a word within multiple directories from a project, MacVim offers this possibility?

See help for vimgrep, args, and argsdo 


David P Henderson
--
"Beautiful bodies and beautiful personalities rarely go together."
    -- Carl Jung

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php



--
 Cliff Oliveira
www.tribodeideias.com.br

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php



--
 Cliff Oliveira
www.tribodeideias.com.br

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php