I want to find for each record in File 1, recursive references in file 2. Meaning, for example, if I consider, ABCD from file 1, it is referenced in File 2, along with LMNO. Then LMNO is internally references WXYZ, and in turn WXYZ references EFGH. There the cycle stops. So the results is
ABCD -> LMNO -> WXYZ -> EFGH.
Similarly next record in file 1 is EFGH for which similar logic applied, result shall be
EFGH -> WXYZ -> LMNO -> ABCD.
Kindly Provide me with a script for achieving this.