On Sunday, May 27, 2012, Tim Chase wrote:
  >On 05/27/12 08:31, john Culleton wrote:
  >
  >> Running a file of commands against a single file.
  >> I can create a file of several hundred commands all of
  >> the form
  >> :% s/foo/bar/
  >> 
  >> Of course foo and bar are different for each such command. Now
  >> I want to run all of those commands against file mainfile. 
  >> 
  >> How do I do this? Or is it easier to use awk?
  >
  >
  > If the colons are in the command-file, you can just yank them
  > all into a register (e.g. "a") and then execute the whole thing
  > as a macro:
  >
  >  :e commands.txt
  >  :%y a
  >  :e mainfile.txt
  >  @a
  
  Alternatively,

       :e mainfile.txt
       :source commands.txt

  --Suresh


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