I have a problem. I want to create program, which print all lines which are in the first file and second file.
awk 'NR==FNR {include[$0];next} $0 in include' eq3_dgdg_1.ndx eq3_dgdg_2.ndx | tee eq4_dgdg_2.ndx
eq3_dgdg_1.ndx input
DGD1 SOL3605
DGD2 SOL1176
DGD2 SOL1598
DGD2 SOL63
eq3_dgdg_2.ndx
DGD1 SOL3605
DGD1 SOL3605
DGD2 SOL1176
DGD2 SOL1176
DGD2 SOL1945
DGD2 SOL63
Output - and here is an error DGD1 SOL3605 - should be only once! Because I have in the first file only one line DGD1 SOL3605, not two, could you help me with that error?
DGD1 SOL3605
DGD1 SOL3605
DGD2 SOL1176
DGD2 SOL63
Expected output
DGD1 SOL3605
DGD2 SOL1176
DGD2 SOL63