I am trying to get a specific line from a text file.
So far, online I have only seen stuff like sed, (I can only use the sh -not bash or sed or anything like that).
Assuming line is a variable which holds your required line number, if you can use head and tail, then it is quite simple:
line
head
tail
head -n $line file | tail -1
If not, this should work:
x=0 want=5 cat lines | while read line; do x=$(( x+1 )) if [ $x -eq "$want" ]; then echo $line break fi done