Hi all,
I'm trying to compare between 2 files in the following manner: if a string in file 1 column 1 is found in file 2 columns 2 OR 3, then print the line from file 2 where a match was found. The catch is that I'm not looking for an exact match- I've found many solutions which solve that.
Example:
The solutions I've found (no good) would yield the following output:
A few clarifications:
1. The fields will always be numbers.
2. The values in file1 can be of any length.
3. The values in file2 can be of any length.
4. The value from file 1 which I'm searching file 2 for can be in any part of column 2 or 3- beginning, middle, or end.
5. File 1 contains roughly 50,000 values, file 2 can contain 4 million +
Thanks a lot in advance!
I'm trying to compare between 2 files in the following manner: if a string in file 1 column 1 is found in file 2 columns 2 OR 3, then print the line from file 2 where a match was found. The catch is that I'm not looking for an exact match- I've found many solutions which solve that.
Example:
Code:
file1.txt 23 1444 223 89
Code:
file2.txt 1,23,34545 1,3223,343433 344,4345,989 12,15,632
Code:
expectedoutput.txt 1,23,34545 1,3223,343433 344,4345,899
Code:
1,23,34545
1. The fields will always be numbers.
2. The values in file1 can be of any length.
3. The values in file2 can be of any length.
4. The value from file 1 which I'm searching file 2 for can be in any part of column 2 or 3- beginning, middle, or end.
5. File 1 contains roughly 50,000 values, file 2 can contain 4 million +
Thanks a lot in advance!
Comment