J
jackster the jackle
I am using ruby to search and match text in a file that has several
mathes.
Here is the text:
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : corp.pc.com
IP Address. . . . . . . . . . . . : 172.1.81.7
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 172.1.81.254
Ethernet adapter Network Connect Adapter:
Media State . . . . . . . . . . . : Media disconnected
Ethernet adapter Wireless Network Connection:
Connection-specific DNS Suffix . : corp.pc.com
IP Address. . . . . . . . . . . . : 172.1.17.116
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 172.1.17.254
What I need to do it pull out the IP address and default gateway IP
addresses for each interface and store them for processing later on in
the script.
What method should I use to get the first ip address and gateway and
store it, then grab the next set and store that?
thanks
mathes.
Here is the text:
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : corp.pc.com
IP Address. . . . . . . . . . . . : 172.1.81.7
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 172.1.81.254
Ethernet adapter Network Connect Adapter:
Media State . . . . . . . . . . . : Media disconnected
Ethernet adapter Wireless Network Connection:
Connection-specific DNS Suffix . : corp.pc.com
IP Address. . . . . . . . . . . . : 172.1.17.116
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 172.1.17.254
What I need to do it pull out the IP address and default gateway IP
addresses for each interface and store them for processing later on in
the script.
What method should I use to get the first ip address and gateway and
store it, then grab the next set and store that?
thanks