I have fileA and fileB.
fileA is storing a list of names I wanted to extract from the second column of fileB.
fileA:
QW123
BH876
PR009
fileB:
MJ194 PR009 100
PR009 IJ940 78
JG948 BH448 58
desire output:
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.
>> $i.output
with for loops to get the output files (where>> $i.output
will generateQW123.output
;BH876.output
andPR009.output
). – web Nov 04 '20 at 17:51$2 in a {print > $2 ".output"}
– steeldriver Nov 04 '20 at 17:59