Supondo que 4 colunas, uma solução de duas passagens
awk 'NR == FNR {if (s[$1]++ == 0)
{printf "%s = fromid=%s, from=%s\n", $1, $2, $1}; next};
!s[$3]++{printf "%s = fromid=%s, from=%s\n", $3, $4, $3}' file file
ABCB11 = fromid=4, from=ABCB11
ABCC8 = fromid=5, from=ABCC8
ACE = fromid=11, from=ACE
CHRM1 = fromid=114, from=CHRM1
CHRM2 = fromid=115, from=CHRM2
DRD2 = fromid=158, from=DRD2
EGF = fromid=164, from=EGF
ADRA1A = fromid=21, from=ADRA1A
ADRA1B = fromid=22, from=ADRA1B
ADRA1D = fromid=23, from=ADRA1D