Using arrays with awk

view story

http://www.unix.com – I'm a little stuck and would be grateful of some advice! I have three files, two of which contain reference data that I want to add to a line of output in the third file. I can't seem to get awk to print array contents as I would expect. The input files are: Code: # Input file AAA,OAA,0313 AAB,OAB,0314 # Ref file1 NAA,123 NAB,456 # Ref file2 0313,123 081A,456 0314,789 I need to match a line in Ref File2 based on the last field of the main input file. I then need to match the last field in Ref File2 to Ref File1. The output should then be: Code: AAA,OAA,03 (HowTos)