Ron Green
9/14/2008 8:32:00 PM
Actually, that was close.
This is what I was kind of looking for.
content =3D File.read('exam.txt')
content.sub!("\n","\nNew Content\n")
File.open('exam.txt','r+').write(content)
But this doesn't work if the first line doesn't end in a new line
character.
On Sep 14, 7:33=A0am, thomas peklak <thomas.pek...@gmail.com> wrote:
> content =3D File.read('test.txt')
> content.sub!("\n","\n\n")
> File.open('test.txt','w').write(content)
>
> sub does replace the first occurence of a new line in the file
>
> thomas