Rewrite last line in text file

From: Magnus Oskarsson (magnus.oskarsson_at_enera.se)
Date: 10/16/03


Date: Thu, 16 Oct 2003 09:10:53 +0200

I have a (potentially large) text file where I sometimes want to write a new
line (at the end), and sometimes replace the last line with a new one (the
new line is never shorter than the old one if that is of any help). Is there
an easy way to do the latter? Note: I do not want to have to rewrite the
entire file each time or to have to parse the file from the beginning, this
must be efficient.

Regards

Magnus Oskarsson



Relevant Pages

  • [ANN] ParseTree 2.0.0 Released
    ... Uses RubyInline, ... Includes UnifiedRuby, allowing you to automatically rewrite ruby quirks. ... ParseTree#parse_tree_for_string lets you parse arbitrary strings of ruby. ...
    (comp.lang.ruby)
  • Re: test if a string is a valid number?
    ... My code does work, does sell, and doesn't require grotesque solutions. ... I can write an FSM to parse an integer as fast as I can type it in. ... who did quick & dirty solutions ended up having to rewrite their code again and again to ...
    (microsoft.public.vc.mfc)
  • Re: Access to cookies in IE vs FF?
    ... wrote:> Steve wrote: ... regards to my question, but who is happy to pass his time to parse my ... clarification, you have now insulted the only person who showed any ...
    (comp.lang.javascript)
  • Re: Is there any other way....
    ... Can u please tell how to parse the HTML of other site. ... >> Regards, ... >> Muhammad Jamil Nawaz ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: ToOADate method
    ... I'm pointing out that the solution was given. ... Asking for someone to rewrite ... what is essentially math, and not at all complex is a bit much. ...
    (microsoft.public.dotnet.framework.compactframework)