grep using -f option

Dear all

     I have a file with more than one patters to search.Such as pattern.txt. I have to grep these patterns into a data file such as data.txt.how to do this ,i tried 

/usr/xpg4/bin/grep -f <pattern_file> <data_file>

Its not working. why or how to search pattern file ?

As double checking means - are there valid patterns in the pattern.txt ?

Exactly I dont know what it does internally...So can you give me how to do this using grep or fgrep...
the pattern_file contains patterns in each line,terminated by <enter>.

That should work then.

Can you please post a sample file containing patterns and a sample data file?

Also the command you had executed to achieve this .
:slight_smile: