MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Read last expression in a file?

  • To: mathgroup at
  • Subject: [mg116113] Re: Read last expression in a file?
  • From: Chris Degnen <degnen at>
  • Date: Wed, 2 Feb 2011 06:10:13 -0500 (EST)
  • References: <ii5rh6$ff3$>

You can find a Windows (XP) version of tail here:

(from the Windows Server 2003 Resource Kit Tools).

While 'tail outputfile' works on the command line, and the output
(last line -0) can be redirected to tail.txt like so:
tail -0 outputfile > tail.txt

the redirection doesn't seem to work when run from Mathematica. I.e.

Run["tail -0 outputfile > tail.txt];

I also tried your version: ReadList["!tail outputfile", Expression]
but no luck with that either.

Any suggestions, anyone?

On Jan 31, 8:23 am, Heike Gramberg <heike.gramb... at> wrote:
> If you are working on unix/linux/os x and your output file contains one expression per line, you could use something like
> ReadList["!tail outputfile", Expression]
> where outputfile is the name of your output file. This basically calls the external command tail which is a program on unix/linux that displays the last few lines of a file.
> I'm not familiar with windows so I don't what the windows equivalent of tail would be.
> Heike.
> On 30 Jan 2011, at 00:43, Ramiro wrote:
> > Hello,
> > I wrote a program that generates a lot of Mathematica output.
> > Now I need to restart it using the very last expression of such output
> > as the new input.   However, I can't find a way to only read the last
> > expression in a file, something like a Read that would start at the
> > end.  It would be too time consuming and perhaps not enough memory in
> > my computer to read the entire file.
> > Any suggestions?
> > Thanks,
> > Ramiro- Hide quoted text -
> - Show quoted text -

  • Prev by Date: Re: Mathematica 8 Home Edition
  • Next by Date: Re: statistical comparison of parameters from two applications of NonlinearModelFit
  • Previous by thread: Re: Read last expression in a file?
  • Next by thread: Re: Read last expression in a file?