I have an input file listed below which contains IP addresses with
other information tacked on after each address. Some of the IP address
are set up in ranges with a '-' and some of them have the wildcard
('*') within them. I need to do is read the file and create a new file
that has non-expanded ip addresses expanded within the range specified
from the existing file. Some of the addresses below also have multiple
'-'s. All the '-'s would have to be expanded. I don't care about
expanding the ip address with the wildcards (*), just the ones with
the '-'s in them.
Input File
===========
10.40.6.130:m0ther:*:8:3:120::m00se:
10.40.6.131:m0ther:*:8:3:120::m00se:
10.40.6.140:m0ther:*:8:3:120::m00se:
10.42.1-3.240-243:m0ther:*:8:2:120::m00se:
10.60.1.2-3:m0ther:*:8:3:120::m00se:
10.60.2.*:m0ther:*:8:2:300::m00se:
10.90.*.*:m0ther:*:8:2:240::m00se:
10.100.*.231-235:m0ther:*:8:2:120::m00se:
152.10-12.*.*:m0ther:*:8:3:120::m00se:
The new output file should look like the following:
Output File
===========
10.40.6.130:m0ther:*:8:3:120::m00se:
10.40.6.131:m0ther:*:8:3:120::m00se:
10.40.6.140:m0ther:*:8:3:120::m00se:
10.42.1.240:m0ther:*:8:2:120::m00se:
10.42.1.241:m0ther:*:8:2:120::m00se:
10.42.1.242:m0ther:*:8:2:120::m00se:
10.42.1.243:m0ther:*:8:2:120::m00se:
10.42.2.240:m0ther:*:8:2:120::m00se:
10.42.2.241:m0ther:*:8:2:120::m00se:
10.42.2.242:m0ther:*:8:2:120::m00se:
10.42.2.243:m0ther:*:8:2:120::m00se:
10.42.3.240:m0ther:*:8:2:120::m00se:
10.42.3.241:m0ther:*:8:2:120::m00se:
10.42.3.242:m0ther:*:8:2:120::m00se:
10.42.3.243:m0ther:*:8:2:120::m00se:
10.60.1.2:m0ther:*:8:3:120::m00se:
10.60.1.3:m0ther:*:8:3:120::m00se:
10.60.2.*:m0ther:*:8:2:300::m00se:
10.90.*.*:m0ther:*:8:2:240::m00se:
10.100.*.231:m0ther:*:8:2:120::m00se:
10.100.*.232:m0ther:*:8:2:120::m00se:
10.100.*.233:m0ther:*:8:2:120::m00se:
10.100.*.234:m0ther:*:8:2:120::m00se:
10.100.*.235:m0ther:*:8:2:120::m00se:
152.10.*.*:m0ther:*:8:3:120::m00se:
152.11.*.*:m0ther:*:8:3:120::m00se:
152.12.*.*:m0ther:*:8:3:120::m00se:
I separated the output file here in this email with a blank line to
make it easier to view the expanded records, the blank line shouldn't
be in the final output file. I think this can be done in AWK, I'm just
not sure how to accomplish it.
Thanks
Rich K.
other information tacked on after each address. Some of the IP address
are set up in ranges with a '-' and some of them have the wildcard
('*') within them. I need to do is read the file and create a new file
that has non-expanded ip addresses expanded within the range specified
from the existing file. Some of the addresses below also have multiple
'-'s. All the '-'s would have to be expanded. I don't care about
expanding the ip address with the wildcards (*), just the ones with
the '-'s in them.
Input File
===========
10.40.6.130:m0ther:*:8:3:120::m00se:
10.40.6.131:m0ther:*:8:3:120::m00se:
10.40.6.140:m0ther:*:8:3:120::m00se:
10.42.1-3.240-243:m0ther:*:8:2:120::m00se:
10.60.1.2-3:m0ther:*:8:3:120::m00se:
10.60.2.*:m0ther:*:8:2:300::m00se:
10.90.*.*:m0ther:*:8:2:240::m00se:
10.100.*.231-235:m0ther:*:8:2:120::m00se:
152.10-12.*.*:m0ther:*:8:3:120::m00se:
The new output file should look like the following:
Output File
===========
10.40.6.130:m0ther:*:8:3:120::m00se:
10.40.6.131:m0ther:*:8:3:120::m00se:
10.40.6.140:m0ther:*:8:3:120::m00se:
10.42.1.240:m0ther:*:8:2:120::m00se:
10.42.1.241:m0ther:*:8:2:120::m00se:
10.42.1.242:m0ther:*:8:2:120::m00se:
10.42.1.243:m0ther:*:8:2:120::m00se:
10.42.2.240:m0ther:*:8:2:120::m00se:
10.42.2.241:m0ther:*:8:2:120::m00se:
10.42.2.242:m0ther:*:8:2:120::m00se:
10.42.2.243:m0ther:*:8:2:120::m00se:
10.42.3.240:m0ther:*:8:2:120::m00se:
10.42.3.241:m0ther:*:8:2:120::m00se:
10.42.3.242:m0ther:*:8:2:120::m00se:
10.42.3.243:m0ther:*:8:2:120::m00se:
10.60.1.2:m0ther:*:8:3:120::m00se:
10.60.1.3:m0ther:*:8:3:120::m00se:
10.60.2.*:m0ther:*:8:2:300::m00se:
10.90.*.*:m0ther:*:8:2:240::m00se:
10.100.*.231:m0ther:*:8:2:120::m00se:
10.100.*.232:m0ther:*:8:2:120::m00se:
10.100.*.233:m0ther:*:8:2:120::m00se:
10.100.*.234:m0ther:*:8:2:120::m00se:
10.100.*.235:m0ther:*:8:2:120::m00se:
152.10.*.*:m0ther:*:8:3:120::m00se:
152.11.*.*:m0ther:*:8:3:120::m00se:
152.12.*.*:m0ther:*:8:3:120::m00se:
I separated the output file here in this email with a blank line to
make it easier to view the expanded records, the blank line shouldn't
be in the final output file. I think this can be done in AWK, I'm just
not sure how to accomplish it.
Thanks
Rich K.