I’m sorry if the title confuses you. Let me explain what I want to do.
In a CSV file, I have few columns:
Product code | Bar code | Status |
---|---|---|
Pcode1 | ABCXY | Good |
Pcode2 | DEFXY | Good |
Pcode3 | GHIXY | Bad |
In a TXT file:
ABC DEF JGU CBG
What I want is to loop through data in column “Bar code” and compare each value with data in TXT file. If value in CSV is “ABCYX” and in TXT has a line of “ABC”, then print out: Pcode1 ABCXY Good
.
The data in CSV’s Bar code will always be data in TXT file plus 2 more characters. Right now I trip down 2 last chars in CSV before compare with TXT.
Is there a better way to achieve what I want to?
Thank you
submitted by /u/tungnm
[link] [comments]
The post How can I check if a value in a CSV file contains a word in a TXT file, then print out data of 2 columns in CSV? appeared first on How to Code .NET.