I have two lists, one of which contains wildcards (in this case represented by *). I would like to compare the two lists and create an output of those that match, with each wildcard * representing a single character.
For example:
File 1
123456|Jane|Johnson|Pharmacist|[email protected]
09876579|Frank|Roberts|Butcher|[email protected]
092362936|Joe|Jordan|Joiner|[email protected]
928|Bob|Horton|Farmer|[email protected]
File 2
1***6|Jane|Johnson|Pharmacist|[email protected]
09876579|Frank|Roberts|Butcher|f**[email protected]
092362936|Joe|Jordan|J*****|[email protected]
928|Bob|Horton|Farmer|b*****n@f*********.co.uk
Output
092362936|Joe|Jordan|Joiner|[email protected]
928|Bob|Horton|Farmer|[email protected]
Explanation
The first two lines are not considered matches because the number of *s is not equal to the number of characters shown in the first file. The latter two are, so they are added to output.
I have tried to reason out ways to do this in AWK and using Join, but I don't know any way to even start trying to achieve this. Any help would be greatly appreciated.