I think what I'd do is run a little magic over file2.txt to turn it into vim commands that can then be executed:
" edit file2.txt
:e file2.txt
" convert the one-per-line replacements
" to commands that search for the next
" instance of "MODULEX" and replace it
" with the item from file2.txt
:%s@.*@:-/MODULEX/s//&
" yank the entire file/script
" into the scratch register
:%y
" split a window to open file1.txt to modify
:sp file1.txt
" execute the script as a macro
" (note this is normal-mode
" not an Ex command)
@"
Odd things may happen if
- you have entries in file2.txt that are replacement metachars such as "\1", "&" or "/"
- your replacements include the value "MODULEX" which then may get subsequently replaced.
Hope that helps you out,
-tim
Thanks a bunch Tim! That worked like a champ.
I've been using vim for years now and I still learn something new practically everyday :-)
-raleigh
--
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