I have a requirement: read the contents of a.txt three lines at a time, read one line from b.txt, then loop and write them into c.txt. How can this be done?
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
@echo off
set p=-1
(for /f "delims=" %%i in (a.txt) do (
echo;%%i&set/a n+=1,m=n%%3
set/a test=1/m 2>nul||call :out
))>c.txt
exit
:out
set/a p+=1
if %p% equ 0 (for /f "delims=" %%j in (b.txt) do (echo;%%j&goto eof)) else (
for /f "skip=%p% delims=" %%j in (b.txt) do (echo;%%j&goto eof))
:eof