On Fri, Nov 16, 2012 at 7:36 PM, Ant <[email protected]> wrote:

> Hello,
>
> 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 like "======================".
>
> For example, the concatenated file couldl ook like this:
>
> ====================================
> FILE 1
> .
> .
> .
> ====================================
> FILE2.txt
> .
> .
> .
> ====================================
> .
> .
>
> .and so on.
>
>
Personally, I don't think I would try to solve this using Vim. Using bash:

: > outputFile
for i in *.vim
do
  echo =================== >> outputFile
  echo $i >> outputFile
  cat "$i" >> outputFile
done

Or, if you put create a shell script called "massCat.sh" or something:

for i in for i in "$@"
do
  echo ===================
  echo $i
  cat "$i"
done

Then you can just execute "massCat.sh *.vim *.txt > outputFile".

Regards,

Salman

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