unix: read line by line help
Posted: Mon May 14, 2007 10:52 am
i'm trying to make a code to read in a file with for example 10 lines of text
and then enter a text at line 5
i also need it to round up the number e.g if theres 11 lines input the added text at line 6
so the script example is:
please enter a line of text:
hello there
please enter file name
filename.txt
line of text successfully added to the middle of the file filename.txt
so out come =
line1
line2
line3
hello there
line4
line5
thanks in advance for your help
and then enter a text at line 5
i also need it to round up the number e.g if theres 11 lines input the added text at line 6
so the script example is:
please enter a line of text:
hello there
please enter file name
filename.txt
line of text successfully added to the middle of the file filename.txt
so out come =
line1
line2
line3
hello there
line4
line5
thanks in advance for your help