Print specific line using a variable

Hi Everyone,

Is there a way I can print specific lines using sed -n '3,3p' file.dat or awk 'FNR==3' file.dat when using variable?

For example, I have this script (get_line.ksh) that accepts line parameter that a user wanted to print in the file.dat.

file.dat
one
two
three
four
 

So if the user ran the script with ./get_line.ksh 4, the script would display four. If the user ran the script with ./get_line.ksh 3, the script would display three and so on...

Thanks,
zzavilz

a) Sure, try it out with sed or awk - you can't break anything.
b) Where is the starting point (line number? string pattern?)?
c) Is this homework?

Have a look into positional parameters for shells.
awk takes variables with -v and for sed you can surround the code with either " at the end and start or have the shell variable separated with some more of these: ' .