I am trying to grep out all of the lines in a file that correspond with words found in another file and then make a third, new file with those lines in it. For example:
File 1
rs2132k34hh
rs234hk5kk4
rsklhh32432
File 2
Info more info otherstuff rs2132k34hh somethings
Info more info otherstuff rs234hk5kk4 somethings
Info more info otherstuff rsklhh32432 somethings
Info more info otherstuff rs234hk5kk4 somethings
I think that it woud be something along the line of
egrep -l "(\s(rs\S+))" /filethatIamsearching.txt > newfile.txt
grep an rs from a file and send to new file
But I know that this isn't everything that should be in the command. Can someone point me in the right direction?