Tuesday, April 24, 2012

RE: How I can run vim commands from a bash script?

Antonio Recio wrote:
> I am trying to write an script to execute a vim command to
> multiples txt files and to overwrite these txt with the
> result. Something like that.
>
> #!/bin/sh
> for i in *.txt; do vim ":%s/foo/bar/g"; done

As others have mentioned, that is not going to work well.

See the following for the Vim procedure:
http://vim.wikia.com/wiki/Search_and_replace_in_multiple_buffers

John

--
You received this message from the "vim_use" 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

No comments:

Post a Comment