0
如何将$ interface添加到列表$ interfaces中?期望追加到列表
expect -re "(.*) ago, via (.*)\r" { lappend interfaces $expect_out(2,string) }
foreach interface $interfaces {
puts "$interface"
}
值2成正则表达式存在,但我的代码返回:
can't read "interfaces": no such variable
while executing
"foreach interface $interfaces {
好的。如果我有更多的线路可以做这样的事情? 而... { 期待-re “(。*)前,通过(。*)\ r”{lappend接口$ expect_out(2,字符串)}} 我想多抢线(更$接口)。 非常感谢你 – user476918
我无法找到一个例子。我想解析更多的行并将匹配的值放入列表中以使用foreach显示。似乎很复杂与TCL :) – user476918
我非常感谢您的帮助。 使用最新的mofidy代码返回:“无法读取”接口“:没有这样的变量” 该命令产生的缓冲区为: * 1.1.1.1,从2.2.2.2,00.00:00之前,通过Int1 3.3.3.3,从4.4.4.4,00:00:00以前,通过Int2 并单独正确解析正则表达式:( – user476918