Wednesday, 18 September 2013

need to print two different strings from a text file using tcl script

need to print two different strings from a text file using tcl script

I have arequirement to get two different strings from two consecutive
lines from a file using tcl script I tried following but it doesn't work.
So here below i need to print string "Clock" and "b0". I am able to print
Clock. but i need both "clock" "b0"
set f [eval exec "cat src.txt"]
set linenumber 0
while {[gets $f line] >= 0} {
incr linenumber
if {[string match "Clock" $line] >= 0 } {
# ignore by just going straight to the next loop iteration
while {[gets $f line] >= 0} {
incr linenumber
if { [string match "b0" $line"]} {
close $out
puts "final $line"
}
puts "\n$line"
continue
}
}
}
close $f

No comments:

Post a Comment