Insert charactera in 1st position of specific lines using vi editor or sed command

Dear all,

i am having text file like below

surya
rama
ranga
laxman
rajesh
reddy

i want add string (OK) before a text from line 3 to 5

the result will be

surya
rama
OK ranga
OK laxman
OK rajesh
reddy

pls help

With 40 post here, you should now how to use Code Tags

awk 'NR>=3 && NR<=5 {$0="OK "$0} 1'
surya
rama
OK ranga
OK laxman
OK rajesh
reddy
1 Like