I want to translate the TCL script for NXOS style. It’s working in IOS but not NXOS.
proc find_matching_ints { cmd } {
set output [exec "show run"]
set ints [list]
set currint ""
foreach line [split $output "\n"] {
if { [regexp {^interface (.*)$} $line ignore interface] } {
set currint [string trim $interface]
}
if { [regexp "^\\s+$cmd\[\\r\\n\]?$" $line] } {
lappend ints $currint
}
}
foreach int [lsort -unique $ints] {
puts $int
}
}
find_matching_ints "bpduguard enable"