无论我插入的数据库表如何,如何检查我最后一次在数据库中写入的时间(时间戳)是什么时候?
请在下面找到传递数组的代码片段,操作数组,但我无法返回新版本的数组.
这是片段:
proc get_mroute_active { &multicast } {
upvar ${&multicast} MULTICAST ;
set group -1 ;
set src -1 ;
set mcast_group_source_id -1 ;
set MULTICAST($mcast_group_source_id,id) $mcast_group_source_id ;
set MULTICAST($mcast_group_source_id,mcast_group) $group ;
set MULTICAST($mcast_group_source_id,mcast_source) $src ;
puts [array size MULTICAST] ;
parray MULTICAST ;
}
array set multicast { } ;
get_mroute_active [array get multicast] ;
puts [array size multicast] ;
parray multicast ;
Run Code Online (Sandbox Code Playgroud)
并且代码的输出是:
3
MULTICAST(-1,id) = -1
MULTICAST(-1,mcast_group) = -1
MULTICAST(-1,mcast_source) = -1
0
Run Code Online (Sandbox Code Playgroud)
能否帮我们看一下如何将"MULTICAST"变量分配给"多播"?
鉴于我有一个巨大的字符串,让我们说1000行,让我们将该字符串命名为"itext".
我只对"itext"中包含单词"Description:"的那些行感兴趣.例如,在原始"itext"字符串中包含字符串"Description:"的行上仅进行以下替换:
regsub -all -- {Loopback} $itext "Lo" itext ;
Run Code Online (Sandbox Code Playgroud)
有没有办法实现这一点(没有逐行,分裂和加入)?
例如,"itext"可以是这样的:
Loopback11 is up, line protocol is up
Hardware is Loopback
Description: Loopback11-Eigrp-National
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Auto-duplex, Auto-speed
input flow-control is off, output flow-control is off
ARP type: ARPA, ARP Timeout 04:00:00
Last input never, output never, output hang never
Last clearing of "show interface" counters never
Input …Run Code Online (Sandbox Code Playgroud) 我想问你的是,为什么下面的代码片段并没有增加变量$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 ]
}
Run Code Online (Sandbox Code Playgroud)
非常感谢.