For text files you may use following batch:
Code: Select all
@echo off
if -%1==- echo Specify filename and target folder as parameters! E.g. %%P%%N %%T for TC. & pause & goto :EOF
set cnumber=0
set output=nul
set output_prefix=%~n1
if not -%2==- set output_prefix=%2\%output_prefix%
for /f "usebackq delims=" %%l in (`type %1`) do call :go "%%l"
pause
goto :EOF
:fmt_output
set /a cnumber=%cnumber%+1
set output_postfix=000%cnumber%
set output_postfix=%output_postfix:~-4%
set output="%output_prefix%_%output_postfix%.vcf"
goto :EOF
:go
echo %~1|find "BEGIN:VCARD">nul
if not errorlevel 1 goto go_found
echo %~1>>%output%
goto :EOF
:go_found
call :fmt_output
echo Creating %output%...
echo %~1>%output%
goto :EOF
It will create files mm_0001.vcf, mm_0002.vcf etc for source file mm.vcf in current folder (or in folder that is specified in 2nd parameter if specified). Note that it will overwrite them w/o questions. May work bad if quotes or characters <, >, | are in a file (have no test files).