search text in files within the subdirectory

Hello,
I am trying to write a shell script to search for a pattern in the directory and show only one entry for each field, essentially I am looking to search for a pattern in a file and list that file name.

One grep will do that

grep -lr <pattern> <directory name>

Thanks
Somasekhar Gajjala.