Pipelines run from left to right. More precisely, the processes run in parallel, but the data flows from left to right: the output of the command on the left becomes the input of the command on the right.
Here the command on the left is
grep tool. Since you're passing a single argument to
grep, it's searching in its standard input. Since you haven't redirected the standard input,
grep is reading from the terminal: it's waiting for you to type.
To search in a file, use
grep tool path/to/file | …
To search in a directory recursively, use
grep -r tool path/to/directory | …
You can filter the results to list only the lines that contain
embed=. Drop the
-r options, they make no sense when the input is coming from standard input.
grep -r tool path/to/directory | grep 'embed='
This lists lines containing both
embed= (in either order). An alternative method with simpler plumbing would be to do a single search with an or pattern; this is always possible, but if the patterns can overlap (not the case here), the pattern can get very complicated.
grep -E -r 'tool.*embed=|embed=.*tool' path/to/directory
If you wanted to list files containing both
embed=, you'd need a different command structure, with the first
grep listing file names (
-l) and the second one receiving those file names as arguments, not as input. Converting standard input into command line arguments what the
xargs command is for.
grep -lZ -r tool path/to/directory | xargs -0 grep -l 'embed='