Sha256: 277aa09d750c58a825d0baaa676df6eeb3535c4323602fb8a246ca0dbb9e8b6a
Contents?: true
Size: 294 Bytes
Versions: 19
Compression:
Stored size: 294 Bytes
Contents
pattern = Regexp.new(ARGV[0]) filename = ARGV[1] count = 0 File.open(filename) do |file| file.each_line do |line| if pattern =~ line line.scan(pattern) do |s| count += 1 end print line.gsub(pattern){|str| "<<#{str}>>"} end end end puts "count: #{count}"
Version data entries
19 entries across 19 versions & 1 rubygems