Hi,

Marc Weber wrote:
> vim was not designed for that kind of task.
> You can pass commands via -c and --cmd (see --help).
> 
> Give this a try:
> 
>   sed -i 's/foo/bar/' *.txt
> 
>   -i = write back file "in place"
> 
> vim foo will open file name 'foo'.
> vim '%/s...' will open file name '%/s...'  (and fail)
> 
> for x in ..
>   vim -c "e $x| %s/ ...  | wq!"
> done
> 
> is close to what you requested, but still no proper escaping for
> filenames.

is there a reason you used ":e $x" inside the parameter of the -c switch
instead of passing the filename as a separate parameter?

  for x in ..
    vim -c "%s/ ...  | wq!" $x
  done

Another approach would be to use Vim's :argdo command:

  vim -c "set autowrite nomore" -c "argdo %s/.../.../" -c "q" *.txt

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us.     (Calvin)

-- 
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

Reply via email to