Ciscoman's notes (Записки цыщика c дипломом)

I'm Cisco Champion Community member for 2017!

I'm Cisco Champion Community member for 2017!
"Cisco Champions are passionate about Cisco and happy to share our knowledge, experience, and feedback."

среда, 9 февраля 2011 г.

eachping.tcl

#-----------------------------------------------------------------------------------------------
#    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"
}

Комментариев нет:

Отправить комментарий

Постоянные читатели

Поиск по этому блогу