I am looking for exact string matches for multiple strings using grep.
Lets say I want to find the following three strings in a large data file that has about 10 Million rows and 10 columns. I want to query the file so I find all the rows that have the following exact strings in them. Thankfully only 1 column has 'rs numbers' so I don't need to specify the column: rs123 rs246 rs689653
I tried the following expression and am returned all options that have these strings in them. In some cases, I'll see rows that have something like 'rs123456', where as I just want rows with the exact matches:
grep -E 'rs123|rs246|rs689653' queriedfile.txt
Then I tried the following expression with ^
and $
but received back NO matches to my query (and I know there are some).
grep -E '^rs123$|^rs246$|^rs689653$' queriedfile.txt