Parsing files .log

Good afternoon, I’m starting in ruby,

I am grieving for a parser to a file.

file_example File.open = “foo.txt”, “r”

file_example.each do | line |

puts line

end

here I can print all lines of the file.

but as I can get only specific lines and use them in a function?

ok. I I separate them with regex. but not know how to use these lines that separated within a function.

If I understand correctly perhaps you need something like

useful_lines = []
file_example File.open = "foo.txt", "r"
file_example.each do | line |
   if some_test_to_indicate_whether_this_is_a_useful_line( line )
       useful_lines << line
   end
end

Colin