I have two files. One with all IDs(in a single field) . And another with data(of which say field 5 is ID). I want to create an array of IDs using first file and
while reading second file if the ID appears in the array I need to print $0 else skip.
After a long gap I am working again in awk.
My code is:
FILENAME == "ID.TXT" { VALIDID[$1]=$1}
FILENAME == "DATA.TXT" { ID=$5;
IF (ID IN VALIDID) PRINT }
Than you. This worked. But one thing I wanted to know,
my code looks fine, but returns nothing. If someone can help me
understand how array is handled here, it will help me with other such
situations as well.