I want to insert a text into the middle of a file
Assume the middle of the file is line 3, this adds a line just after line 2, that becomes the new line 3, old line 3 becomes 4, and so on:
sed '/2/a\
text to insert' oldfile > newfile
Thanks, but i dont want to use sed or awk
Is this a homework question? If not, what is the real world problem?
Regards