Hello following is a piece of code that compare two files named m1 and f1 and searches for a string that contain 'circuit1' in m1 and see if similar string consisting of string1 is there in f1. If I run the script I get a warning that extra character after close brace at the line that contain while {[gets $master_file line] >= 0 }{. Can you please where is the flaw that such a warning comes?
proc comparison {m1 f1} {
set master_file [open $m1 r]
set compare_file [open $f1 r]
set masterlist {}
set comparelist {}
set result {}
while {[gets $master_file line] >= 0 }{
if {[regexp {circuit1} $line]}{
lappend masterlist $line
}
}
while {[gets $compare_file line] >= 0 }{
if {[regexp {circuit1} $line]}{
lappend comparelist $line
}
}
for {set i 0} { $i< [llength $comparelist]} { incr i} {
for {set j 0} {$j < [llength $masterlist] } {incr j} {
lappend result [string compare [lindex $comparelist $i] [lindex $masterlist $j]]
}
set comp_var [lsearch $result "1"]
if {$comp_var eq -1} {
puts "[lindex $comparelist $i]"
}
set result {}
}
close $master_file
close $compare_file
}
comparison file1 file2