On 11/17/2012 1:50 PM, Tim Chase wrote:
> On 11/16/12 18:36, Ant wrote:
>> this one is something I need help in. Say I have thousands of
>> files and I wanted to concatenate them all into one. THis is easy
>> to do, I can just do it outside Vim using bash script "cat * >
>> allfiles.txt" or something.
>>
>> But how would you concatenate heaps of files together, separating
>> them by its filename or some unique thing
> You allude to how you get the source of your filenames ("*" = all
> files in the current directory), so to do similarly in Vim, I might
> do something like
>
> :enew
> :r! /bin/ls " on *nix
> :r! dir /b " on Win32
> :%sort " optionally sort, as dir/ls may not return sorted
> " though you could pass switches to ls/dir to sort
> :1d " delete the first blank line
> :g/^/-put=repeat('=',50)|+|exec 'read '.getline('.')
> " insert a divider of 50 "=" characters,
> " move back to the line with the filename,
> " read the file named on the given line
>
> This also has the advantage that, if you have the filenames in a
> file already, you can just use that, instead of reading the
> filenames into the file contents. In theory, the above should also
> work with subdirectories too if you need.
>
> -tim
>
>
try this:
http://code.google.com/p/filemerger/
this is something I produced long time ago, to get done what I needed.
its very basic and need a lot enhancement, but it works and got my work
done.
it can find specified type of file from a folder (or even a tar.gz ball)
and cat them into a big file with(or without) an additional mark for Vim
VOom plugin(my favorite).
let me know if you have any questions.
--
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
Monday, November 19, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment