sed command help

Hi All,

I have a script which has the following lines

----------------------------------------
filename =detail.txt
text='hai'
var1=`cat $filename|grep text|sed 1q`
echo var1
--------------------------------

I just want to know what does sed 1q does?

Thanks in advance
LM

1) 1: Print the first line.
2) q: Quit, exiting "sed".
The "q" is very usefull for a very large file, so that "sed" does not
continue to read the entire file.