Long story short I am checking a rather lengthy error log. I would like to find and parse the ip address associated with each error.
example I want to parse
client: 12.345.678.910
def check_file( file, string )
File.open( file ) do |io|
io.each do |line|
result << parse_ip( line ) if line.include? string
end
end
result
end
def parse_ip( flag )
flag = flag.split.find_all{|word| /^client:.+/.match word}
ip = flag. # need to grab ip here
ip
end
Is there a simple way to get next word?
I am just not sure how to grab the characters following "client:"
Any assistance is appreciated.
EDIT: syntax error