Mirror318
Mirror318

Reputation: 12683

How do you pipe output to the end of a file? (Java, Terminal)

I currently type this in the command line:

javac *.java && java NeuralNetApp > xorMomentumTest.txt

This erases everything in xorMomentumTest.txt and then fills it with output from the program.

What I want it to do is add the output to the end of xorMomentumTest.txt, instead of replacing its contents, so that I can run the program many times and keep all the output.

Upvotes: 2

Views: 992

Answers (1)

Tom
Tom

Reputation: 2389

Try this:

javac *.java && java NeuralNetApp >> xorMomentumTest.txt

This is more of an Operating System question, than a Java question. I'm assuming you have a unix or linux OS.

Upvotes: 1

Related Questions