Page 1 of 1

Insert into text file some text from a script

Posted: Thu Dec 23, 2010 7:15 pm
by andrescamino
Hello,

How can I insert into a text file some information for example I would like to insert into different lines the numbers 1 to 10 into a text file and save it into the files.
/file print file=Number
/file set Number.txt contents=" " 
:for i from=1 to=10 do={ :put $i }
but instead of showing that on the terminal everytime I run it...I would like it to be saved on the contents of Number file in different lines...

Re: Insert into text file some text from a script

Posted: Thu Dec 23, 2010 7:20 pm
by mrz
{
 :local tmp "";
 /file print file=Number

 :for i from=1 to=10 do={ :set tmp "$tmp\r\n$i" }
 /file set Number.txt contents=$tmp 
}


Re: Insert into text file some text from a script

Posted: Thu Dec 23, 2010 7:29 pm
by andrescamino
Tks mrz...it works just like i wanted..