MathGroup Archive 2011

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

Search the Archive

Re: Read last expression in a file?


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


  • Prev by Date: Re: Remove Symbolize
  • Next by Date: Re: ascii quotes in Program cell
  • Previous by thread: Re: Read last expression in a file?
  • Next by thread: Re: Read last expression in a file?