Re: Read last expression in a file?

*To*: mathgroup at smc.vnet.net*Subject*: [mg116134] Re: Read last expression in a file?*From*: Albert Retey <awnl at gmx-topmail.de>*Date*: Thu, 3 Feb 2011 05:29:13 -0500 (EST)*References*: <ii5rh6$ff3$1@smc.vnet.net> <iibea5$nul$1@smc.vnet.net> <iibh70$ol8$1@smc.vnet.net>

Hi, >> >> 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? >> I've seen you have a version that works, but if you are interested in a version which doesn't create an intermediate file here is something that also works for me on Windows (with tail installed from the Resource Kit Tools): Import["!tail -0 \"" <> fname <> "\"", "Text"] my filename did contain spaces, so I needed the enclosing "". Actually to see what goes wrong it is useful to redirect stderr to stdout, so you can see error messages, like here: Import["!tail -0 \"" <> fname <> "\" 2>&1", "Text"] once you have the command line running, you can of course also use ReadList directly to perform the conversion to Mathematica expressions: ReadList["!tail -0 \"" <> fname <> "\"", Expression] hth, albert