any script can be used to covert IP subnet?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting any script can be used to covert IP subnet?
# 1  
Old 03-04-2009
any script can be used to covert IP subnet?

say I have some netblocks, is it possible I can use a script to covert the subnet to every single ip?

for example, raw file has
"1.2.3.0 255.255.128.0"
"2.3.4.0 255.255.255.254"

and I want to run the script and print out every single IP in these netblocks.

or will it be easier if I change the raw file to netmasks format?
"1.2.0.0/17"
"2.3.4.0/31"

Last edited by fedora; 03-04-2009 at 07:39 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Covert xml to csv using xsltproc in shell script

Hi, I am not familiar with shell scripting. Please help to convert xml files to csv files using xsltproc command in bash script. Find the xml sample <?xml version="1.0"?> -<Source xmlns="link"> <CompanyCd>DSP</CompanyCd> <SrcSysCd>DSPS</SrcSysCd> <CountryCd>45</CountryCd> ... (2 Replies)
Discussion started by: mathina
2 Replies

2. Shell Programming and Scripting

How to write bash script to subdivide a given subnet into a pre-defined number of smaller subnets?

Bash script to subdivide a given subnet into a pre-defined number of smaller subnets. Show network/broadcast address, number of hosts and assign gateway. For example: Input: ./subnetter.sh 192.168.0.0/24 3 Output: 192.168.0.0/128 subnet 192.168.0.0 broadcast 192.168.0.127 gateway... (1 Reply)
Discussion started by: mail2rias
1 Replies

3. Shell Programming and Scripting

How to write bash script to subdivide a given subnet into a pre-defined number of smaller subnets?

Bash script to subdivide a given subnet into a pre-defined number of smaller subnets. Show network/broadcast address, number of hosts and assign gateway. For example: Input: ./subnetter.sh 192.168.0.0/24 3 Output: 192.168.0.0/128 subnet 192.168.0.0 broadcast 192.168.0.127 gateway... (1 Reply)
Discussion started by: mail2rias
1 Replies

4. Shell Programming and Scripting

Covert simple bash script in perl language

Hello, Anyone please covert this in perl language ######################## if ps faux | grep -v grep | grep ProcessXYZ then echo "$SERVICE is running, , everything is fine" exit 0 else echo "$SERVICE is not running" exit 2 fi Additional... (1 Reply)
Discussion started by: fed.linuxgossip
1 Replies

5. Shell Programming and Scripting

Bash script for ping in your own subnet

I have a question for one who wants to help me. I want to create a bash script to ping IP-adresses. It must first ask me the beginnen IP, then the ending IP like: 192.168.100.1 - 192.168.100.255. When nothing is filled in, then it must find my subnet and ping that, like when my ip is... (14 Replies)
Discussion started by: ugurgazi
14 Replies

6. Programming

how to covert string into 2 diff int

i got a string E.g "12.67" how do i convert it into a int so that a= 12 b =67 any one can guide me along? (8 Replies)
Discussion started by: xiaojesus
8 Replies

7. Shell Programming and Scripting

Apache Subnet consolidation script/routine help needed

I have a rather simple routine that I would like to fine tune. I am having scripters block if that exists. Trying to tally up that amount of subnets after I performed an awk and uniq from zipped apache logs. For instance, on a solaris 10 system: This does work gunzip -c access_log1.200834.gz |... (2 Replies)
Discussion started by: NYG71
2 Replies

8. IP Networking

Migrating existing Subnet to a new subnet and changing ip addresses in UNIX

Hi, My project needs to migrate the existing Subnet (255.255.255.0) to a new subnet and change the ipaddresses (currently C class). How can I do that. I need some information. John (0 Replies)
Discussion started by: johnmarsh
0 Replies

9. Shell Programming and Scripting

Covert case of first letter only

Using sed or tr, how do I change "fred" into "Fred" or "fReD" into "Fred" (1 Reply)
Discussion started by: tisons
1 Replies
Login or Register to Ask a Question
netmasks(4)							   File Formats 						       netmasks(4)

NAME
netmasks - network mask database SYNOPSIS
/etc/inet/netmasks /etc/netmasks DESCRIPTION
The netmasks file contains network masks used to implement IP subnetting. It supports both standard subnetting as specified in RFC-950 and variable length subnetting as specified in RFC-1519. When using standard subnetting there should be a single line for each network that is subnetted in this file with the network number, any number of SPACE or TAB characters, and the network mask to use on that network. Network numbers and masks may be specified in the conventional IP `.' (dot) notation (like IP host addresses, but with zeroes for the host part). For example, 128.32.0.0 255.255.255.0 can be used to specify that the Class B network 128.32.0.0 should have eight bits of subnet field and eight bits of host field, in addition to the standard sixteen bits in the network field. When using variable length subnetting, the format is identical. However, there should be a line for each subnet with the first field being the subnet and the second field being the netmask that applies to that subnet. The users of the database, such as ifconfig(1M), perform a lookup to find the longest possible matching mask. It is possible to combine the RFC-950 and RFC-1519 form of subnet masks in the net- masks file. For example, 128.32.0.0 255.255.255.0 128.32.27.0 255.255.255.240 128.32.27.16 255.255.255.240 128.32.27.32 255.255.255.240 128.32.27.48 255.255.255.240 128.32.27.64 255.255.255.240 128.32.27.80 255.255.255.240 128.32.27.96 255.255.255.240 128.32.27.112 255.255.255.240 128.32.27.128 255.255.255.240 128.32.27.144 255.255.255.240 128.32.27.160 255.255.255.240 128.32.27.176 255.255.255.240 128.32.27.192 255.255.255.240 128.32.27.208 255.255.255.240 128.32.27.224 255.255.255.240 128.32.27.240 255.255.255.240 128.32.64.0 255.255.255.192 can be used to specify different netmasks in different parts of the 128.32.0.0 Class B network number. Addresses 128.32.27.0 through 128.32.27.255 have a subnet mask with 28 bits in the combined network and subnet fields (often referred to as the subnet field) and 4 bits in the host field. Furthermore, addresses 128.32.64.0 through 128.32.64.63 have a 26 bits in the subnet field. Finally, all other addresses in the range 128.32.0.0 through 128.32.255.255 have a 24 bit subnet field. Invalid entries are ignored. SEE ALSO
ifconfig(1M), inet(7P) Postel, Jon, and Mogul, Jeff, Internet Standard Subnetting Procedure, RFC 950, Network Information Center, SRI International, Menlo Park, Calif., August 1985. V. Fuller, T. Li, J. Yu, K. Varadhan, Classless Inter-Domain Routing (CIDR): an Address Assignment and Aggregation Strategy, RFC 1519, Network Information Center, SRI International, Menlo Park, Calif., September 1993. T. Pummill, B. Manning, Variable Length Subnet Table For IPv4, RFC 1878, Network Information Center, SRI International, Menlo Park, Calif., December 1995. NOTES
/etc/inet/netmasks is the official SVr4 name of the netmasks file. The symbolic link /etc/netmasks exists for BSD compatibility. SunOS 5.10 7 Jan 1997 netmasks(4)