I have two files, team1.txt and team2.txt
team1.txt =========== Alex Bob Charlie David
team2.txt =========== Alex Charlie Benjamin Zed Noah
I want to output the people who are in both team1 and team2 using a unix command.
$ cat team1.txt | xargs grep -s team2.txt -e
team2.txt:Alex
The problem is that this is incorrect. Both Alex AND Charlie are in team1 and team2. But for some reason grep
stops after the first match. Why is this? xargs
should be running grep on every line from team1.txt
.