grep multiple patterns + the whole word only

Guys,

i used egrep "pattern1|pattern2". But the whole word is searched. But i want the output if only the exact word is matched. i.e the output is got evenif a part of the pattern is matched.

I tried the -w opion but its showing usage error.

Please help me out on this one. please sent me the exact command run on your console. I am using a Solaris8.

You might want to try this

egrep "^pattern1$|^pattern2$" filename

Perhaps giving an example filea and sample of expected output will help.

hey yongitz... thanks for that
That worked