Robert Klemme
8/3/2007 12:59:00 PM
2007/8/3, Jon Hawkins <globyy3000@hotmail.com>:
> look into using the .slice(# , #) method. so long as you know the
> length of the first line u can probably just slice it out
This is a dangerous approach as it will work for the minority of cases
only (i.e. when old and new line have the exact same length). Though
you could make it work for cases where the new line is shorter than
the old line things get messy if you try to cope with the opposite
case.
Ah, and Jeffrey, do yourself a favor and use the block form of
File.open (btw, your sample does not work anyway since
File.open(file_name) will open for reading only).
File.open(foo, "a") {|fi| fi.puts x}
Kind regards
robert