I have two files named file1 and file2. I want to compare both files and print the similar lines in another file. I used `awk` and `grep` but didn't get any solution. I checked so many answers related to my questions but also not so helpful in my case.

File 1:

```
 UDP-N-acetylenolpyruvoylglucosamine reductase K00075 murB; UDP-N-acetylmuramate dehydrogenase EC:1.3.1.98
 UDP-N-acetylglucosamine 1-carboxyvinyltransferase K00790 murA; UDP-N-acetylglucosamine 1-carboxyvinyltransferase EC:2.5.1.7
 UDP-N-acetylmuramate--L-alanine ligase K01924 murC; UDP-N-acetylmuramate--alanine ligase EC:6.3.2.8

```

File 2:

```
D      ZPR_2530 UDP-N-acetylglucosamine 1-carboxyvinyltransferase K00790 murA; UDP-N-acetylglucosamine 1-carboxyvinyltransferase EC:2.5.1.7
D      ZPR_3743 UDP-N-acetylenolpyruvoylglucosamine reductase K00075 murB; UDP-N-acetylmuramate dehydrogenase EC:1.3.1.98
D      ZPR_3807 UDP-N-acetylmuramate--L-alanine ligase K01924 murC; UDP-N-acetylmuramate--alanine ligase EC:6.3.2.8
D      ZPR_3810 UDP-N-acetylmuramoylalanine--D-glutamate ligase K01925 murD; UDP-N-acetylmuramoylalanine--D-glutamate ligase EC:6.3.2.9
D      ZPR_3812 UDP-N-acetylmuramoylalanyl-D-glutamate--2 K01928 murE; UDP-N-acetylmuramoyl-L-alanyl-D-glutamate--2,6-diaminopimelate ligase EC:6.3.2.13
D      ZPR_0820 D-alanyl-alanine synthetase A K01921 ddl; D-alanine-D-alanine ligase EC:6.3.2.4
D      ZPR_3928 UDP-N-acetylmuramoyl-tripeptide--D-alanyl-D-alanine ligase K01929 murF; UDP-N-acetylmuramoyl-tripeptide--D-alanyl-D-alanine ligase EC:6.3.2.10
D      ZPR_4441 putative undecaprenol kinase K06153 bacA; undecaprenyl-diphosphatase EC:3.6.1.27
D      ZPR_3043 PAP2 superfamily membrane protein K19302 bcrC; undecaprenyl-diphosphatase EC:3.6.1.27

```

Expected output:

```
D      ZPR_3743 UDP-N-acetylenolpyruvoylglucosamine reductase K00075 murB; UDP-N-acetylmuramate dehydrogenase EC:1.3.1.98
D      ZPR_2530 UDP-N-acetylglucosamine 1-carboxyvinyltransferase K00790 murA; UDP-N-acetylglucosamine 1-carboxyvinyltransferase EC:2.5.1.7
D      ZPR_3807 UDP-N-acetylmuramate--L-alanine ligase K01924 murC; UDP-N-acetylmuramate--alanine ligase EC:6.3.2.8

```

Command that I used:

```
awk 'NR==FNR{a[$1]=$NF;next;} {print ($0 ? a[$1] OFS $0 :$0)}' no-tab-file.txt Non-homo-Dzpr00001.txt

```

Also:

```
grep -Ff Non-homo-Dzpr00001.txt no-tab-file.txt

```