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

Answer Posted / indu sharma

In above answer if you have IP like 10.30.30.1 then it replace for all 30 with 40.But here i guess intention is just to replace one octet with 40.So following solves that issue:


set a 10.30.2.1
set b [ string replace $a 3 4 40 ]
puts $b

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Hi all, Is there any certification exams available for TCL and Perl. If so please let me know, my mailid is vpbharathi@gmail.com. Thanks in advance, Bharathi.P

2527