I'm trying to match two files and print the match result and leave empty line for unmatch result, based on the Number column 3. The idea here to make the two file length the same .
example: file 1
BMW 111 N1
BENZ 123 N2
TOYOTA 122 N3
file2
N1
N23
N3
result:
BMW 111 N1
*blank line (N23 does not exit in file 1*
TOYOTA 122 N3
I used AWK to match the two file but I'm not able to insert blank line
awk 'NR==FNR{a[$1];next}$3 in a{print $1,$2,$3}' file2.txt file1.txt > result.txt
as in https://stackoverflow.com/questions/977408/how-do-i-insert-a-blank-line-every-n-lines-using-awk