136155Re: Loading directory of files, into a single file, in VIM
- Feb 16, 2013On 2013-02-16 13:02, Russell Urquhart wrote:
> I have a directory of html files, (that are actually xml files,There are several ways to go about this. One can create the combined
> misnamed extension wise.) I would like to have all those files
> loaded, one after another into a single file, is that possible in
file on-disk with something like
:argdo w! >> combined.xml
which will load up each HTML file and then iterate over them,
appending them to a file on disk.
Alternatively, you can accumulate them in a register, e.g. "z" with
:let @z='' | argdo %y Z
which will iterate over all your HTML files appending their contents
to the "z" register (the uppercase version appends, as noted at
":help quotea"). It then creates a new buffer, pastes the contents
of the "z" register, and deletes the blank line under which it was
Note that in both case, you can modify the range to select a subset
of the file, so if you just want to write the <body> content, you can
do something like
:argdo /<body/+1,/<\/body>/-1w! >> combined.xml
Hope this gives you some options to work with.
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
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
For more options, visit https://groups.google.com/groups/opt_out.
- << Previous post in topic Next post in topic >>