unix: read line by line help

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
fdmhelp
Forum Newbie
Posts: 1
Joined: Mon May 14, 2007 10:47 am

unix: read line by line help

Post 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
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

this seems more like a homework assignment.. what have you tried so far? and what are the available tools?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Post Reply