Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
dg1
dg1
Level III

Adding extra line before saving text file

I currently have a for loop in which I am saving the content into seperate text files. Before I save each file I want to add an empty row at the start of each file (because I plan on manually adding information later).  My current approaches seem to not work. Do you guys have any suggestions?

1 REPLY 1
Highlighted
txnelson
Super User

Re: Adding extra line before saving text file

Something like this might work:

// Save the file
dt << save( "c:/mydata/test.txt" );
// read it backin
xx=load text file("c:/mydata/test.txt");
// add the first line
xx=xx || " \!n";
// write the file back
save text file("c:/mydata/test.txt",xx);
Jim
Article Labels

    There are no labels assigned to this post.