I havent find anything on internet so i need your help.
I have 2 CSV Files that i would like to compare:
the first one is like :
"Name","PrimarySmtpAddress","EmailAddresses"
the second one is like :
"Name","$_.TotalItemSize.Value.ToMB()"
Yy output file must show which name is both in first and second files
And i want to have, as output, a file with all the data in the first files but with the "$_.TotalItemSize.Value.ToMB()" added a the end of each lines.
for exemple it would do something like :
"Name","PrimarySmtpAddress","EmailAddresses","$_.TotalItemSize.Value.ToMB()",
I think i have to use Findstr but i dont know how to use it in my case.
Someone can help me please ?
Thank you.
Batch comparing 2 differents csv files
Moderator: DosItHelp
Re: Batch comparing 2 differents csv files
Please provide accurate real world examples of both of your input files and then provide an accurate example of what the output should look like. Your pseudo examples can be misleading.
Re: Batch comparing 2 differents csv files
Provided at least the name is enclosed in surrounding quotation marks ...
Steffen
Code: Select all
@echo off &setlocal
set "csv1=file1.csv" &REM "Name","PrimarySmtpAddress","EmailAddresses"
set "csv2=file2.csv" &REM "Name","$_.TotalItemSize.Value.ToMB()"
set "csvout=fileout.csv"
>"%csvout%" (
for /f usebackq^ tokens^=1*^ delims^=^" %%h in ("%csv1%") do (
for /f tokens^=1*^ delims^=^" %%j in ('findstr /bc:^^^"\"%%h\"^^^" "%csv2%"') do (
if "%%j"=="%%h" echo "%%h"%%i%%k
)
)
)
Steffen