Found the extra bit that takes file names and reads them. Obviously,
it's File.read, and you just need to pop it in the right place ...
The answer (as many good answers do) came from Why's Poignant Guide,
Chapter 4, Part 3 (Chaining Delusions Together)
http://poignantguide.net/ruby/chapter-4.html
The key part of the script now reads:
def find_redir
File.open("found-redir-lines.txt", "w") do |out|
Dir['ex*.log'].each do |file_name|
# new bit below
file = File.read( file_name )
file.grep(/redir/) { |line| out.puts(line) }
# and can also be any of these ...
#file.each_line { |line| o.puts line if line["redir"] }
#file.each_line { |line| o.puts line if line =~ /redir/ }
end
end
end
So thanks people, thanks _why, and thanks Ruby !
drew