At the top of the XYZ file, I need to insert the ABC data value of column 2 only when ABC column 1 matches the prefix XYZ file name (not the ".txt"). Is there an awk solution for this?
Actually, I was wildly guessing WHAT your spec could mean. My proposal worked fine with three files whose names were listed in a "file name" file which in turn was matched against an ABC data file.
Obviously my interpretation regarding your file structure was wrong. Please post the file structure in your directory and some sample files.