I'm trying to parse 2 text files and make one with information from both files using cmd or batch, is it possible without using any other program or vbscript? Here is the example: number.txt contains
ren 01.mp3
ren 02.mp3
ren 03.mp3
and so on...
names.txt contains
Chapter_00_Introduction.mp3
Chapter_01_This_is_Chapter_01.mp3
Chapter_02_This_is_Chapter_02.mp3
Chapter_03_This_is_Chapter_03.mp3
and so on...
What I'd like is to produce a third file (output.txt) with this content
ren 01.mp3 Chapter_00_Introduction.mp3
ren 02.mp3 Chapter_01_This_is_Chapter_01.mp3
ren 03.mp3 Chapter_02_This_is_Chapter_02.mp3
and yes, the names are mismatched (01.mp3 is actually the introduction, 02.mp3 is the chapter 1 and so on).
This is what I have so far:
@echo off
setLocal EnableDelayedExpansion
for /f "tokens=*" %%a in (Number.txt) do (
For /f "tokens=*" %%b in (Names.txt) Do (Echo %%a%%b.mp3>>output.txt)
)
Exit
The result is
Ren 01.mp3 Chapter_00_Introduction.mp3
Ren 01.mp3 Chapter_01_This_is_chapter_02.mp3
Ren 01.mp3 Chapter_03__This_is_chapter_03.mp3
Ren 01.mp3 Chapter_04__This_is_chapter_04.mp3
@echo off
setLocal EnableDelayedExpansion
< Names.txt (
for /f "tokens=*" %%a in (Number.txt) do (
set /P name=
Echo %%a !name!
)
) >output.txt
Exit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With