grep and awk showing filename in loop

I am attempting to grep a list of files for a string an and then only extract the 3rd and 4th field of from the line. That's easy. But I want to prefix the line with the filename that the information came from.

for filename in `ls -1 *.txt'
do
grep search_text $filename | awk '{print $3" "$4}'
done

This displays the 3rd and 4th field of all lines in the list of files as in:
Field3 Field4
Field3 Field4

but I would like to see
a.txt Field3 Field4
b.txt Field3 Field4

Can somone give me a clue on how to do this.

Thanks,
Scott
f

You can do something like that :

for filename in `ls -1 *.txt'
do
   awk '/search_text/ {print FILENAME,$3,$4}' $filename 
done

or (/dev/null in case where no file *.txt found'

awk '/search_text/ {print FILENAME,$3,$4}' *.txt /dev/null

Jean-Pierre.

Sjohns,
Using your solution:

for filename in `ls -1 *.txt'
do
  OutStr=`grep search_text $filename | awk '{print $3" "$4}'`
  echo $filename $OutStr
done

Thanks...this got me on the right track but I left something out that causes this solution to have a problem. The files are am searching through are gzipped. When I try to gunzip the file and pipe the data to awk, awk now things the FILENAME is standard in. Any thoughts?

for filename in `ls -1 *.txt.gz`
do
{ gunzip < $filename 2>>/dev/null; echo $?>>rc.txt; } | awk '/search_text/ {print $3,$4}'
done

Try...

for filename in `ls -1 *.txt.gz`
do
{ gunzip < $filename 2>>/dev/null; echo $?>>rc.txt; } | awk -v f=$filename '/search_text/ {print f,$3,$4}' 
done

Perfect!!
Thank you!