I have a variable as in,
set recA "Description : 10/100/Gig-Ethernet-TX-test
Interface : 1/1/18 Oper Speed : N/A
Link-level : Ethernet Config Speed : 1 Gbps
Admin State : down Oper Duplex : N/A
Oper State : down Config Duplex : full"
If i give my input as "Description" , i need print the value as "10/100/Gig-Ethernet-TX-test"
Similarly, if my input is "Config Speed" , i need to print the values as "1 Gbps"
i tried like this but did not get the output properly for "Config Speed"
set lines [split $recA
]
set index [lsearch -regexp $lines "Description"]
set match [lrange $lines [expr $index] [expr $index]]
set b [lindex [lindex [split [join $match " "] ":"] 1] 0]
puts $b
for "Description" i get the output as 10/100/Gig-Ethernet-TX-test
for "Config Speed" , i get the output as "Ethernet" instead of "1 Gbps"
Can someone help ?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…