TCL (Tool Command Language) Question:
Download Questions PDF

Set ip address as 10.30.20.1 write a script to replace the 30 with 40?

Answers:

Answer #1
here you can do this in multiple ways

1.regsub 30 $data 40 a
puts $a

this will give you the replaced string

2.string replace $data 3 4 40

this also will give you the replaced value

Answer #2
set ip "10.30.20.1";
regsub "30" $ip "40" newip;
puts $newip

Download TCL Interview Questions And Answers PDF

Previous QuestionNext Question
How to check whether a string is palindrome or not using TCL script?Where can we find the sample tcl programs?