exact string matching for multiple strings with grep
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
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
I'd really appreciate some input! Thanks!
grep string
New contributor
add a comment |Â
up vote
0
down vote
favorite
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
I'd really appreciate some input! Thanks!
grep string
New contributor
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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
I'd really appreciate some input! Thanks!
grep string
New contributor
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
I'd really appreciate some input! Thanks!
grep string
grep string
New contributor
New contributor
New contributor
asked 5 mins ago
Sheila
101
101
New contributor
New contributor
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sheila is a new contributor. Be nice, and check out our Code of Conduct.
Sheila is a new contributor. Be nice, and check out our Code of Conduct.
Sheila is a new contributor. Be nice, and check out our Code of Conduct.
Sheila is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f479025%2fexact-string-matching-for-multiple-strings-with-grep%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password