Search Mulitiple String pattern in a file

Hi,

I need to search for a multiple string pattern(5 key words) in a file(similar to a flat file) ,and i need to store the output in a another file .

In that file we may have mutiple occurrences of the key words.and i need only the unique.

kindly help out.

Thanks,
Mohana Krishnan

Hi Mohana Krishnan,

I don't understand this line. Can you explain it.

In that file we may have mutiple occurrences of the key words.and i need only the unique.

To search multiple patterns in a file u can use grep with -e option.

grep -e pattern1 -e pattern2 -e pattern3 filename > newfile.

Regards,
Chella

Or 'egrep / grep -E':

egrep 'term1|term2|term3'