regexp to get first line of string

Hi everybody

for file in *
#Bash performs filename expansion
#+ on expressions that globbing recognizes.
do
	
	output="`grep -n "$1" "$file"`"
	echo "$file: `expr "$output" : '\(^.*$\)'`"

done

In the above bash script segment, I try to print just the first line of string named output.

I've got a problem with the regexp. It returns the full string which is multilined.

Thank you in advance for any help

You can try :

echo ""$file: `echo "$output" | sed -n 1p`"

Jean-Pierre.

grep -n "$1" "$file" | read output

Thank all of you