Re: Read last expression in a file?
- To: mathgroup at smc.vnet.net
- Subject: [mg116115] Re: Read last expression in a file?
- From: Chris Degnen <degnen at cwgsy.net>
- Date: Wed, 2 Feb 2011 07:03:34 -0500 (EST)
- References: <ii5rh6$ff3$1@smc.vnet.net> <iibea5$nul$1@smc.vnet.net>
Actually this works fine: Run["tail -0 outputfile > tail.txt"]; Import["tail.txt"] On Feb 2, 11:14 am, Chris Degnen <deg... at cwgsy.net> wrote: > You can find a Windows (XP) version of tail here:http://malektips.com/xp_= dos_0001.html > > (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. > using > > Run["tail -0 outputfile > tail.txt]; > Import["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 gmail.com> 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 th= e 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 outpu= t > > > as the new input. However, I can't find a way to only read the la= st > > > 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 -- Hide quoted text - > > - Show quoted text -