What I would like to ask you is, why the following snippet does not increment the variable $times ?
#!/usr/bin/tclsh
set logging {
LC/0/1/CPU0:Jan 27 08:24:17.014 CET: ifmgr[175]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/1/0/33, changed state to Down
LC/0/1/CPU0:Jan 27 08:24:17.014 CET: ifmgr[175]: %PKT_INFRA-LINEPROTO-5-UPDOWN : Line protocol on Interface GigabitEthernet0/1/0/33, changed state to Down
}
set times 0
set records [ split $logging "\n" ]
foreach rec $records {
puts $rec
incr $times 1
puts $times ;# puts [ incr $times 1 ]
}
Many thanks.
It should be
or simply