Skip to content
Advertisement

How to make a strict match with awk

I am querying one file with the other file and have them as following:

File1:

JavaScript

File2:

JavaScript

This command:

JavaScript

returns lines that overlap, BUT doesn’t have a strict match. Having a strict match, only Helen Stanley should have been returned.

How do you restrict awk on a strict overlap?

Advertisement

Answer

With your shown samples please try following. You were on right track, you need to do 2 things, 1st: take whole line as an index in array a while reading file2.txt and set field seapeator to | before awk starts reading file1

JavaScript

Command above doesn’t work for me (I am on Mac, don’t know whether it matters), but

JavaScript

worked well

Advertisement