Seven Languages in Seven Weeks: Day 2
A grep work-a-like which despite being much shorter then the previous exercise actually has the possibility of being useful:
pattern = Regexp.new(ARGV[0])
path = ARGV[1]
File.open(path, "r").each_with_index do |line, i|
puts "#{path}:#{i + 1}\t#{line}" if line.index(pattern)
end