Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Help with merging two csv's batch script

2 Weeks Ago   #1
carllam

windows 10 Pro
 
 
Help with merging two csv's batch script

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:
How do I merge two csv files side by side with batch script

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 System SpecsSystem Spec
.
2 Weeks Ago   #2
carllam

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 System SpecsSystem Spec
Reply

 Help with merging two csv's batch script




Thread Tools




Similar help and support threads
Thread Forum
Run Malwarebytes in a batch script!
Good evening, I am trying to run Malwarebytes that was downloaded to the default location in a batch script running in Vista 32-bit but without much success at the moment! I am basically trying to run a quick scan in silent mode. This is what I have tried ... ...
Chillout Room
Help Need in batch script
Hi, I have my vendor's ftp url over SSL. it's like ftps://myvendor.com and i have username and password. So please help me on writing batch script t o downlod the file from my vendor repository. If this is not possible in dos script, please suggest me opensource tool. But i would love the...
General Discussion
How to run cmd.exe elevated in batch script
Hi All, I am writing a dos batch file for windows7 and it has many commands which need elevated access to run. For elevation I am using elevate.exe. I am doing like below - set Elevation=elevate -wait cmd.exe /c %Elevation% "cd /d %CD% && xcopy /E /Y ...." %Elevation% "cd /d %CD% &&...
General Discussion
batch script help
dear all any help to make batch script this the reason i want to make a batch file is to help me update the online games in 60 computers by overwriting or copying big files in one click from 1 source computer... instead of turning on all 60 computers and updating all online games, he'll just...
General Discussion
Help me with Batch script!
Hi, Can somebody assist me with a .bat file I am trying to create? This is what I have now: start /d "C:\Users\Me\Desktop\ghost" ghost.exe start /d "C:\Users\Me\Desktop" Poweroff.exe C:\Windows\System32\powercfg.exe /setactive e428f8a5-615e-488f-b7f7-1ed39450e522The first 2 lines start...
Software


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 15:50.
Twitter Facebook