I have two files - one with some IDs (text file) and other with IDs and descriptions (tab file).
31120 211890 542312
chr10 31120 A T Descriptions Chr11 131120 A T Descriptions chr12 23765090 G C Descriptions chr15 784930 A G Descriptions
chr10 31120 A T Descriptions
Random selected columns some matching the file1 IDs and some not.
I am using
grep -f file1 file2 > output.txt to match my IDs from
file1 and extract their info from
file2. However the problem lies, when I have an ID say- 31120. It find me IDs like 31120, 231120, 311200 etc.
Since I am running one file to find patterns in another what can I use to make it specific to my search so that only 31120 is returned. While it is easy to do so in a regular one liner grep search, I don't know how I can do that when 2 files are being compared.
I have tried using
grep -F -f file1 file2 but that did not work.
Now I used grep -Fwf file1 file2, which is not working either.