Skip to contentSkip to conversation

Bash Script

DISCUSSION Kev 2 participants 2 messages Nov 21, 2005

lore
Share & tools
lore

Kev

author
#0 lore raw

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

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#1 lore raw
Quoted 9 lines · Kev

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 ?

I don't know too much about RBL DNS servers, but changing the number sequence around for an IP should be pretty easy:

#!/bin/sh

IP='192.168.1.2'
echo $IP|sed -r 's/^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/\4.\3.\2.\1/'

Essentially, it performs a regular expression replace. It finds the four groups of numbers and reverses the order (#4 goes first, #3 second, etc.).

--
Chris Largret <http://daga.dyndns.org>

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs