I have a list of genes like this one saved on a variable:
NOL6
NPPC
NPRL2
NRG1
NT5C1B
NUDT19
OSER1
PAEP
PARD3
PCDHA4
I want to grep all these genes at another list:
chr3 NPRL2
chr5 NT5C1B
chr5 NT5C1B-RDH14
chr2 NUDT19
chr21 ABC
I tried this:
grep -w "^$genes$" list.txt
The problem is that it returns to me genes with a dash too:
chr3 NPRL2
chr5 NT5C1B
chr5 NT5C1B-RDH14
chr2 NUDT19
I tried to use -x
but it doesn’t work as the complete line doesn’t match because of the first column.