At 10:45 +0600 11/21/2005, Kev wrote:
im having a prb transferring the ip in reveres format (192.168.1.2
--> 2.1.168.192)
can any one help me to do this with a bash script ?
Pure BASH:
ip=10.1.22.123 # test address
rev="${ip##*.}" # Get last octet
tmp="${ip%.*}" # Strip last octet
rev="${rev}.${tmp##*.}" # Add third octet
tmp="${tmp%.*}" # Strip third octet
rev="${rev}.${tmp#*.}.${tmp%.*}" # Add first two octets (in reverse order)
unset tmp
echo "$rev" # Display reversed address
--
Jeff Woods <kazrak+kernel@xxxxxxxxxxx>
-
: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html