I have fileA and fileB.
fileA is storing a list of names I wanted to extract from the second column of fileB.
QW123 BH876 PR009
MJ194 PR009 100 PR009 IJ940 78 JG948 BH448 58
MJ194 PR009 100 JG948 BH448 58
I am trying it with the command below but none of them worked. Wondering what is left out in between the codes.
for i in $(cat fileA); do awk '$2=="$i"' fileB; done
for i in $(cat fileA); do awk -v 'i="$i"' '$2=="i"' fileB; done
Any help would be much appreciated.