Grep Wildcard search

How can i grep for a pattern with wildcard using grep?

I want to identify all the lines that start with SAM and end in .PIPE

 
 
IN.TXT
 
SAM_HEADER.PIPE
SAM_DETAIL.PIPE
SAM_INVOICE.PIPE
 

Can i do something like

 
 
grep SAM*.PIPE IN.TXT

it didnt really work

Should be '.*' and if you didn't quote it on the command line you should.

grep "SAM.*PIPE" IN.TXT

You also might want to grep for this:

"^SAM.*PIPE$"

That pattern anchors 'SAM' at the beginning of the line, and 'PIPE' at the end of the line.

That did the trick..Thanks