Created
April 15, 2016 12:47
-
-
Save anonymous/f09cdcbfb7d574e45a490135649b5313 to your computer and use it in GitHub Desktop.
Regex for extracting IP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
output = "IP address : 192.168.9.2 | |
NetBIOS name : DOMAIN-DC-2 | |
DNS name : here-is-1-dns.name.com | |
IP address : ffff:eeff:20ff:480:ffff:4461:87aa:ce7e | |
IP address : 192.168.9.7 | |
NetBIOS name : DOMAIN-DC-5 | |
DNS name : here-is-2-dns.name.com | |
IP address : ffff:eeff:20ff:480:ffff:4461:87aa:fdce | |
IP address : 192.168.0.1 | |
NetBIOS name : DOMAIN-DC-4 | |
DNS name : here-is-3-dns.name.com | |
" | |
dc_list = output.split(/\n/) | |
@saved_dc = dc_list[0].split(/: */).last.chomp | |
puts "Saving DC IP: #{@saved_dc}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment