I have file A.txt which is a lists of unique ids (column 1) and its corresponding values(column 2):A.txtABC1D_T1_B1  123.4ABC2D_T1_B2  146.7ABC3D_T1_B1  567.8ABC4D_T0_B2  96.8ABC1D_T0_B1  145.9Second file is B.txt, not unique but has duplicated entries ABC1D_T1_B1ABC1D_T1_B1ABC2D_T1_B2ABC3D_T1_B1ABC3D_T1_B1ABC4D_T0_B2ABC1D_T0_B1ABC1D_T0_B1How can I grep B.txt from A.txt and report the values of col 2 for the repeated listResult:ABC1D_T1_B1  123.4ABC1D_T1_B1  123.4ABC2D_T1_B2  146.7ABC3D_T1_B1  567.8ABC3D_T1_B1  567.8ABC4D_T0_B2  96.8ABC1D_T0_B1  145.9ABC1D_T0_B1  145.9ABC1D_T0_B1  145.9Normally if unique entries are there in B.txt then grep -Fw -f B.txt A.txt >Result.txtHow can I do this for multiple repeating entries using grep?
grep for repeated values from pattern list
bash;awk;grep
Since you have also tagged awk:awk 'FNR == NR {a[$1] = $0; next}; {print a[$1]}' A.txt B.txtI don't think a single grep can do this, but a combination of xargs and grep:xargs -I{} grep -Fw -- {} A.txt < B.txt