Message Boards Message Boards

Writing from a notebook to a textfile, using the MAC OS X terminal?

Posted 4 years ago

Given the following code in a Mathematica notebook named test.nb:

var = 3*Exp[t] - 4*t;
Export["test.txt", var];

I can make the files test.m and test.wls corresponding to test.nb.

However, I would like to obtain the output in test.txt by using the MAC terminal.

How can this be done?

I've tried the following:

wolframscript -file test.nb

and

/Applications/Mathematica12.app/Contents/MacOS/MathKernel -noprompt -run "<<test.m"

but neither approach yields output.

Thanks in advance for any help.

POSTED BY: A M
2 Replies
Anonymous User
Anonymous User
Posted 4 years ago

you might want to use ImportForm[] or other form if the text form output is not to your liking (for ex: inputform uses '/' for division with (()), while another form (standard?) uses numerator --------- denominator spaced for easy viewing on 3 lines)

POSTED BY: Anonymous User
Posted 4 years ago

In test.wls

var = 3*Exp[t] - 4*t;
Export["test.txt", var];

From the shell

wolframscript -file test.wls
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract