I have a huge text file called dictionary.txt with entries like
ABC_SEQ_NUM This represents.... ABC_RANK This represents.... ABC_BSC_ID This represents... PQR_TA_DATE_AF This represents... XYZ_C_ID This represents...
In another file, I have the source for a program that is using some of these abbreviations as part of its variable names. The variable names often use the above entries as follows
So I am not able to simply search for TMP_ABC_SEQ_NUM using grep, because it would return no match. However, the last part of the variable name ("ABC_SEQ_NUM") is actually present in the text file.
So I would like to say something like
grep (longest match for) TMP_ABC_SEQ_NUM in dictionary.txt
So that it would return the match for
How to write such a command?