find command with -exec

Hi People,

I have a directory full of compressed files (.Z extention)
In many of these files there is a string pattern (3800078163033)

I want to find all file names which contain this string in their text.

Regards,
Abhishek

Do you mean in the filename itself or within the actual compress file?

If you mean just the filename then :-

find *3800078163033*.Z 

should work.

If you mean within the file then i'm not sure if there's an equivalent as below for files compressed with compress but if they were gzipped or bzipped there is bzcat and gzcat so you could do :-

string="3800078163033"

for file *.Z
do
   if [[ -n "$(gzcat $file | grep $string)" ]];then
       echo "File [$file] contains string [$string]"
   fi
done 

Thanks Lavascript...I wnated the 2nd solution and it Worked!!!