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

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -