gzcat/grep

Hi!!!

I am trying to grep a number in more then 1000 files which are .gz.
Below is the code :-

for i in `ls 20090618yz*_07.znf.gz`
do
a=`gzcat 20090618yz*_07.znf.gz | grep 9814843011`
if [ -n "$a" ]
then
echo $i 
fi
done

My objective is to echo the file name also with the data.

Please help!!!!
Thanks in advance....

Please use code tags! do you have zgrep? or gzgrep?

for i  in 20090618yz*_07.znf.gz
do
  [[  zgrep -q 9814843011 $i ]] && echo "$i"
done

This works with my zgrep. It will also run a lot faster without all of the `` and extra processes your were creating.

Do you have awk:

gzcat filename | nawk '/pattern/ {printf "%s %s\n",$0,FILENAME}'

No the awk didn`t worked.
It gave me the same output as before, no filename in it.
Below is the output string without filename.

# # #20090618# # # # # # # # # #9#919814843011# #91# # # #3496#-100# # # # # # # #D@27#1# -

Also i dont have zgrep installed.