Write a program to increment IP address to +10 and verify it is correct ip or not ??
example my ip is 172.122.132.143 increment this ip to +10 and verify it is valid ip or not
Answer / thiru
set ip "10.255.255.255"
set list [split $ip "."]
set oct1 [lindex $list 0]
set oct2 [lindex $list 1]
set oct3 [lindex $list 2]
set oct4 [lindex $list 3]
if {$oct4>254} {
set oct4 0
set oct3 [expr $oct3+10]
if {$oct3>255} {
set oct3 0
set oct3 [expr $oct3+10]
if {$oct2>255} {
set oct2 0
set oct3 [expr $oct1+10] }
if {$oct1>255} {
set oct1 0
}}} else {
set oct4 [expr $oct4+10]
}
puts "$oct1.$oct2.$oct3.$oct4"
| Is This Answer Correct ? | 0 Yes | 0 No |
Which scripting language is better among TCL Perl and Python and why?
Set ip address as 10.30.20.1 write a script to replace the 30 with 40 ?
How to extract "information" from "ccccccccaaabbbbaaaabbinformationabcaaaaaabbbbbbbccbb" in tcl using a single command?
What does Tcl stand for?
Where can find the sample tcl programs?
How do you find the length of a string without using string length command in TCL??
how to write the startup scripts in winrunner? can any body explain with example code?
How TCL works
{Anu Anudeep Anukumar Amar Amaravathi Aruna} is their any possibility to find the letter "a"in the given list? if yes how?
Write a proc to increment the ip by the given no. of times. The incremented IPs should be a valid one. Ex: proc <name> {ip no_of_incrments} { body }
how to remote log in to a system A to system B ,execute commands in it and collect the log in system A from B using TCL script??
1 Answers Global Edge, Sandvine,
Test case on windows calculator?