RE: Bash Script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kev, you can use awk for this:)

#!/bin/bash

ip_address=192.168.1.2

reversed=`echo $ip_address | awk 'BEGIN { FS = "."; OFS = "." } ; { print
$4, $3, $2, $1 }'`

echo $reversed

-----Original Message-----
From: linux-admin-owner@xxxxxxxxxxxxxxx
[mailto:linux-admin-owner@xxxxxxxxxxxxxxx]On Behalf Of Kev
Sent: Monday, November 21, 2005 3:45 PM
To: 'Linux Mail List'
Subject: Bash Script


Hi,

im trying to setup a RBL DNS server for my testing. 
im trying to write a bash scrip that add the IP's to add bind zone.

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 ?

thanks a lot
Kev

-
: 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
-
: 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

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux