grep a specific line from a file

Is there a way to grep only one line from a file listing name of files?
If I use head -1 it's ok(the first line only)
If I use head -2 it's not good because I have already checked the first line.

I'd like something like this:

 
while test $i -le $max 
do
  grep "$3" `head -$i temp.txt`  > temp2.txt
  cat temp2.txt
  i=`expr $i + 1`
done

but the head command doesn't give only the i line as I would like.
Thank you in advance.

Have you tried the -m flag?

awk 'NR=='$i temp.txt

Thank you all,but I don't understand 'NR=='

Should I put there $3(the argument I want to compare every line)?

awk '$3=='$i temp.txt
awk '$3'$i temp.txt

Both doesn't work.

You would just be using awk rather than head.

grep "$3" `awk 'NR=='$i temp.txt ` > temp2.txt

Though you could have used head anyhow:
`head -$i temp.txt|tail -1`

If you are simply looping over a file, why not:

i=0
for fname in `cat temp.txt`
do
if test $i -gt $max; then
break
fi
grep "$3" $fname > temp2.txt
cat temp2.txt
i=`expr $i + 1`
done