Re: Comparing two files line by line



Niv wrote:
I don't think the while { [gets $f1 inline1] >= 0}
{ will work, as how do I get the data-line from $f2?

The same way.

while { [gets $f1 inline1] >= 0 } {
set hasline [gets $f2 inline2]
if {$hasline < 0} {puts "F1 longer than F2"; exit}
... compare $inline1 and $inline2
}
while { [gets $f2 inline2] >= 0 } {
puts "Extra line in F2: $inline2"
}



--
Darren New / San Diego, CA, USA (PST)
This octopus isn't tasty. Too many
tentacles, not enough chops.
.



Relevant Pages

  • Re: readline
    ... quotes, not the files), followed by a binary number (as well as other ... Can I do the gets $f1 inline2, ... puts $f2 $data ...
    (comp.lang.tcl)
  • readline
    ... quotes, not the files), followed by a binary number (as well as other ... Can I do the gets $f1 inline2, ... if {$command eq w} { ... puts $f2 $data ...
    (comp.lang.tcl)
  • Re: readline
    ... quotes, not the files), followed by a binary number (as well as other ... Can I do the gets $f1 inline2, ... puts $f2 $data ...
    (comp.lang.tcl)