J
Joe Van Dyk
Is there a prettier way to read a file and return the last word in each line?
Here's my go:
File.read(some_file).to_a.map { |l| line.split.last }
What if I wanted to search the lines (based on a regex) and return the
last word in each line that satisfied the search criteria?
Joe
Here's my go:
File.read(some_file).to_a.map { |l| line.split.last }
What if I wanted to search the lines (based on a regex) and return the
last word in each line that satisfied the search criteria?
Joe