Piping STDOUT as pattern to grep or sed

$>cat file.txt
123 d3
234 abc 3
zyf 23
124 def 8
ghi kz0
...
...

I have the following output on the screen through <some command>.
$> <some command>
abc
def
ghi
...
...

I have to search for each of these patterns in the file.txt and print the lines in file.txt matching the output of <some command>.

I have tried to pipe it to grep like this
$> <some command> | xargs grep file.txt
But grep takes the pipe output as file and not as pattern.

Is there any way the output on STDOUT can be piped as pattern to grep or sed or awk without using a perl script.

Thanks & Regards
VNR

<some command>|while read SEARCH
do
grep "${SEARCH}" file.txt
done

Not able to identify SEARCH variable

Output is
SEARCH : Undefined variable

Btw I use csh

Thanks & Regards
VNR

egrep has (and some greps have) an option to read the patterns from a file.

If your OS (like Solaris) provides a mechanism to access
file descriptors as filenames, one can use this to read file descriptor 0 (stdin)
for the patterns.

<some command> | egrep -f /dev/fd/0 filename

Yeah this worked on the solaris machine. Thanks very much

VNR