grep the string with the line number

Dear Masters,
Here i have some doubts can anyone clarify?.

Is it possible to grep the lines by specifying the line numbers.

I know the line number which i want to grep.
example:
grep 40th line filename
grep 50th line filename

Need ur comments.

To print the 40th line:

sed '40q;d' file

or

awk 'NR==40 {print;exit}'

Regards

You can use nawk 'NR==40' filename to grab particular line

Dear all,
Thanks a lot.:b:

you gotta love help you get in here...these folks are freekin awesome!