I have a list of letters in a file called "letters.txt" and a list of number of occurrence of each letter in a file called "LetterPerSample.txt",both files are arranged, so first row of letters.txt has "a" second has "b"...etc, and same for SamplePerLetter.txt the first row has max nymber of "a",second has max number of "b" and so in,i want to create a list of files like this a_1,a_2,.....a_max.txt, where max is a number as listed above, and each file generated has it's own letter written inside. So a_1.txt has "a" written inside, b_5.txt has "b" written and so on
what i have done so far is:
@echo off
setlocal enableDelayedExpansion
for /f "tokens=*" %%a in (letters.txt) do (
set letter=%%a
for /f "tokens=*" %%b in (SamplePerLetter.txt) do (
set num=%%b
for/L %%g IN (1,1,!num!) do (
set index=%%g
echo !letter!>letter_labels/!letter!/!letter!!index!.lab
)
)
)
sample of the output
a_1.txt
a_2.txt
...
a_10.txt
b_1.txt
b_2.txt
...
b_10.txt
but a and b doesnt have the same number of occurrence in the file LetterPerSample.txt a has 10 and b has 5, so what's wrong with my code?