🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Putting text from a loop in a variable

User: "mkress"
New Altair Community Member
Updated by mkress

Hi guys,

my script reads a document and afterwards manipulates every line of it. step by step, every line is written into an outfile.

 

'while {[gets $data lines] >=0} {

 

…..

 

set outfile [open $path/report.txt a+]

 

...

 

if {![regexp {N/A} $field2]}      {

 

….

 

puts $outfile '[format $formatStr $a $b $field1 [format '%.1f' $dif_temp]]'

 

 

 

}

close $outfile

 

}'

 

 

 

Now I want to put every lines in a variable, that I don´t need the outfile. But with “set” I have only the last line of the loop in the variable.

 

set var '[format $formatStr $a $b $field1 [format '%.1f' $dif_temp]]'

 

 

 

 Could anyone help me there?

Find more posts tagged with

Sort by:
1 - 2 of 21