I am processing IP source/destination/port lists created as acl requests The request looks some thing like this:
source IP destination IP Port
76.211.12.9 10.112.12.232 1521
The Source and destination IP's have three distinct formats
- x.x.x.x,y,z
- x.x.x.x-z
- x.x.x.x,y.y.y.y,z,z,z,z
I want to create output
- x.x.x.x
x.x.x.y
x.x.x.z - x.x.x.x
x.x.x.y
x.x.x.z - x.x.x.x
y.y.y.y
z.z.z.z
using bash, sed ,awk how can I accomplish this? in my example:
76.211.12.9,10,11 10.112.12.232 1521
76.211.12.9-11 10.112.12.232 1521
Both outputs would look like this:
76.211.12.9 10.112.12.232 1521
76.211.12.10 10.112.12.232 1521
76.211.12.11 10.112.12.232 1521