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 |
if i give in numbers output should be in characters example : set a 23 o/p twentythree
How increment a character? For example, I give 'a' and I should get 'b'.
write a regular expressions to fetch all the valid ip's
What does Tcl stand for?
How to Swap 30 & 40 in IP address 192.30.40.1 using TCL script?
{Anu Anudeep Anukumar Amar Amaravathi Aruna} is their any possibility to find the letter "a"in the given list? if yes how?
1.What are the different ways to initialize a variable. How to differentiate global and local variables, explain it through a simple tcl program. 2.Create a list of week days and print the first and last character of each day using foreach command 3.Can you write a small program to verify the given input is file or directory.Before checking, just ensure that the file/dir exists or not in the given path. If the given input is a file, findout the size and verify that the file has all read ,write and execute permission.
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
How to extract "information" from "ccccccccaaabbbbaaaabbinformationabcaaaaaabbbbbbbccbb" in tcl using a single command?
WHAT IS TCL?
Problems with utf-8 between Mac and PC
how to write a startup script in winrunner