# Evaluate a list of Expressions from file

I have a list of expressions in a text file. I would like mathematica to evaluate and export the results at the end of the same file or in a new file. The expressions are in seperate lines in the text file.

-

cat a.txt
{Series[f[x],{x,x0,10}],Plot[Sin[x],{x,-Pi,Pi}]}


Then

SetDirectory[NotebookDirectory[]];
expr = Import["a.txt"]


result = ToExpression[expr]


Export["result.txt", result]


then

>cat result.txt


-