|
Other BSD and UNIX/UNIX-like Any other flavour of BSD or UNIX that does not have a section of its own. |
|
Thread Tools | Display Modes |
|
|||
Help with script
Hello friends
I need help, I have three files with thousands of subnets, sometimes I need to unlock an ip that is connected to some or some subnets. I need a script that typing the IP look for these three files showing the subnets attached to that IP, removing the subnet automatically remove the block for the IP. the method I use currently allows me to find in which file the subnet is, but finding the subnet is not so easy. I use linux ubuntu and the files are in "ipset" format, the script can be in bash, perl, python, etc ... Thanks for the help. |
|
|||
I have no idea what ipset format is, but seems like this is an awk one-liner.
|
|
|||
Quote:
add country-name xxx.xxx.xxx.xxx/xx add country-name xxx.xxx.xxx.xxx/xx basically one subnet per line |
|
|||
Still not entirely sure what you're asking. Can you write out an actual line you want to change and what you want to change it to?
|
|
|||
Quote:
./findip.sh 187.221.32.45 /root/country.txt and as a result: 187.221.32.0/24 I do not have advanced knowledge in bash script to do it. My language is Portuguese, I'm using google translate to write this. |
|
|||
Please upload one of those files here (if you can).
|
|
|||
That includes subnetting arithmetic...
better yet grep 187.221.32 /root/country.txt then awk to exclude the country name if that is needed. An educated guess anyway
__________________
FreeBSD 13-STABLE |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Learning to script... | RJPugh | Programming | 7 | 9th November 2014 08:04 PM |
Script: how translate for i in `seq $1 $2`? | aleunix | OpenBSD General | 5 | 12th March 2012 07:38 PM |
Handy X11 script | Gabe_G23 | Guides | 6 | 25th October 2008 05:08 PM |
my 1st sh script | graudeejs | Programming | 12 | 18th August 2008 10:25 PM |
Perl Script | c0mrade | Programming | 1 | 26th June 2008 05:04 AM |