Page 1 of 1

unix: read line by line help

Posted: Mon May 14, 2007 10:52 am
by fdmhelp
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

Posted: Mon May 14, 2007 12:50 pm
by timvw
this seems more like a homework assignment.. what have you tried so far? and what are the available tools?

Posted: Mon May 14, 2007 3:31 pm
by Ambush Commander