Loyall
asked on
Powershell partial identical values two csv files
Hi,
I have two quite large csv files that contain values like this:
File one:
000074-e8ec29,33
00c0af-012651,28
file two:
000074 Amsterdam,On
00C0AF Berlin,Add
Is there a way that I can make powershell compare the first six digits of file one and two an than combine those in a new file, so it give me:
000074-e8ec29,33,000074 Amsterdam,On
00c0af-012651,28,00C0AF Berlin,Add
Thanks in advance !!
I have two quite large csv files that contain values like this:
File one:
000074-e8ec29,33
00c0af-012651,28
file two:
000074 Amsterdam,On
00C0AF Berlin,Add
Is there a way that I can make powershell compare the first six digits of file one and two an than combine those in a new file, so it give me:
000074-e8ec29,33,000074 Amsterdam,On
00c0af-012651,28,00C0AF Berlin,Add
Thanks in advance !!
Does "quite large" mean that we cannot cache at least one of them in memory? If we can't, a slow, filesystem based merge have to be done.
Surely you can just first divide them into 2 parts with Data "-" this can now in 2 sheets be used to do Vlookup
- Rancy
- Rancy
ASKER
Hi,
I,m sorry for my delayed response. Personal issues took control.
Dan, is your offer to write a script still valid ?
Kind regards,
Loyall
I,m sorry for my delayed response. Personal issues took control.
Dan, is your offer to write a script still valid ?
Kind regards,
Loyall
Loyall,
please answer my question in http:#a41238506, so we can suggest a best-effort script (slow and file based versus fast and memory based).
please answer my question in http:#a41238506, so we can suggest a best-effort script (slow and file based versus fast and memory based).
ASKER
Hi Qlemo,
The files can be cached in memory.
Kind regards,
Loyall
The files can be cached in memory.
Kind regards,
Loyall
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much Qlemo !!
But you can use pretty much any programming language (including powershell) to:
- read the first file line by line
- for each line search in the second file for a line starting with the first 8 characters of the current line
- if found, add it to the current line and write it to another file
If no one shows with a script by tonight I'll write one.
HTH,
Dan