Solved Help with merging two csv's batch script

carllam

New member
Local time
7:21 AM
Messages
2
Hi there, I have two files that I would want to merge:
file 1:
Invoice,02012020,Client 1 Plc,
Invoice,02012020,Client2 Plc,
Invoice,02012020,Properties Plc,
Invoice,02012020,Client1 Plc,

file 2:
57694049.pdf
47990 jre.pdf
_488 file.pdf
__4857 fkke-dl.pdf

The output I am trying to get to is the following:
Invoice,02012020,Client 1 Plc,57694049.pdf
Invoice,02012020,Client2 Plc,47990 jre.pdf
Invoice,02012020,Properties Plc,_488 file.pdf
Invoice,02012020,Client1 Plc,__4857 fkke-dl.pdf

I have been looking at a previous thread on Sevenforums:
https://www.sevenforums.com/general...rge-two-csv-files-side-side-batch-script.html

and tried to adapt the code but getting the following output:
Invoice,02012020,Client,1,Plc,57694049.pdf
Invoice,02012020,Client2,Plc,47990,jre.pdf
Invoice,02012020,Properties,Plc,_488,file.pdf
Invoice,02012020,Client1,Plc,__4857,fkke-dl.pdf

Can anyone tell me where I am going wrong? any help will be great!!
 

My Computer

Computer type
PC/Desktop
OS
windows 10 Pro
Hi all,

Found a solution to my question. It is a lot more simple than I thought it would be. The solution is below if anyone is interested:
echo off
setlocal EnableDelayedExpansion

< File2.csv (
for /F "delims=" %%a in (File1.csv) do (
set /P line2=
echo %%a,!line2!
)
) > CombinedFile.csv
 

My Computer

Computer type
PC/Desktop
OS
windows 10 Pro
Back
Top