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 of the same type on a txt. I tried this:
grep -w "^$genes$" list.txt
The problem is that it returns to me genes with a dash -
like this one similar to NT5C1B:
NT5C1B-RDH14
However, if I search the gene individually:
grep "^NT5C1B$" list.txt
I'll not obtain the gene with the dash but only:
NT5C1B
Is there any way to do this using grep -w
or other command?