Ruby retrieve data from file after specific label -
how can specific data file in ruby? want 10. ip addresses file set this...
whatever: xathun ip_address: 10.2.232.6 etc: aouoeu more: snthuh
i want push ip addresses array.
i can pull 10. addresses out of text. hoping more accurate way in data after 'ip_address:' label in case there unwanted matching data.
s_text = file.open("test.txt",'r').read ip_addresses = s_text.scan(/\d+.\d+.\d+.\d+/) puts ip_addresses.inspect #=> ["10.2.232.6"]
Comments
Post a Comment