basically i am writing a program that requires the functionality of being able to either replace a specific line of text by looping through every line and comparing or being able to take a line number and then replacing it with new text preferably the second solution. so say i have a text file
the
sky
is
blue
and i want to replace the word sky with ocean. either i can say loop through and find words of the value sky or i can specify that the line i want to replace is on line 2 and then replace it like that. either way the solution should be
the
ocean
is
blue
I have no clue how to do this any help is appreciated.