[c-nsp] tcl basic question

selamat pagi ketimun at gmail.com
Thu Jun 26 07:20:01 EDT 2014


Im very new to tcl scripts, therefore please apologies this question, I was
not able to answer to myslef, even after googling for quite some time.

My script:

 set COPP [ exec {show policy-map control-plane} ]
 foreach map [ regexp -inline {Class-map:[^\n]+\s } $COPP ] {
  }

if [ regexp -all {conformed (\d+) packets} $COPP map0] {
  puts -nonewline "$map $map0"
 }




Gives output:
Class-map: SNMP (match-all)
  conformed 38118 packets


Required output:
Class-map: SNMP (match-all) conformed 38118 packets    --> on same line

I tried with option -nonewline or \n but somehow I did not get it right.

many thanks, keti


More information about the cisco-nsp mailing list