Say I have an already existing .txt file containing data in the following format.

$a \qquad b$

Now at different times I will successively have data like "c,d,e,f,g,h,i" etc

Now next time as I will have the data "c", I want the data to be appended in the first row with tab separation. That is like this:

$a \qquad b \qquad c$

And then next time I will have the data "d". So next time what I want is

$a \qquad b \qquad c$


and so on.

Though from this answer, I know how to add data in the newline using OpenAppend, but I don't know how to add data in the same line with tab separation.


1 Answer 1


OpenAppend itself does not cause newlines to be added. Only the export/write functions do. If you use WriteString, it won't add newlines.

For example,

s = OpenAppend["app.txt"]

Do[WriteString[s, "a"], {5}]


results in a file containing aaaaa.

You can include tabs using "\t".


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.