I have a text file containing names (nameslist.txt) and I want to read them using cat and pipe the result with xargs to a grep command, so that grep checks the existence of each name that it receives in a target file (targetfile.txt).
Let's say targetfile.txt contains a large number of names which might have some of those names in nameslist.txt.
What should I add between xargs and grep, and between grep and ./targetfile.txt, below?
cat ./nameslist.txt | xargs grep ./targetfile.txt
Thank you