#-----------------------------------------------------------------------------------------------
# Simple TCL script for Cisco IOS to ping each device in a column of some command output
# Author: Eugene K.
#
# invoke with tclsh eachping.tcl "IOS exec command" "column index"
# please remeber to quote command argument
#-----------------------------------------------------------------------------------------------
set command [lindex $argv 0]
set index [lindex $argv 1]
if { [ catch {
foreach line_a [split [exec $command] "\n"] {
if {[ regexp -inline {[0-9/.]+} [lindex $line_a $index] ] != "" } { ping [lindex $line_a $index] }
} } e]} {
puts "Not enougth arguments or command error. $e"
}
# Simple TCL script for Cisco IOS to ping each device in a column of some command output
# Author: Eugene K.
#
# invoke with tclsh eachping.tcl "IOS exec command" "column index"
# please remeber to quote command argument
#-----------------------------------------------------------------------------------------------
set command [lindex $argv 0]
set index [lindex $argv 1]
if { [ catch {
foreach line_a [split [exec $command] "\n"] {
if {[ regexp -inline {[0-9/.]+} [lindex $line_a $index] ] != "" } { ping [lindex $line_a $index] }
} } e]} {
puts "Not enougth arguments or command error. $e"
}
Комментариев нет:
Отправить комментарий