Skip to content

Instantly share code, notes, and snippets.

@changs
Created January 15, 2017 12:56
Show Gist options
  • Save changs/ddb74be24d95fc82ed5d6387beb1c9f8 to your computer and use it in GitHub Desktop.
Save changs/ddb74be24d95fc82ed5d6387beb1c9f8 to your computer and use it in GitHub Desktop.
#!env ruby
require 'date'
from = Date.new(*ARGV[1].split(',').map(&:to_i)).to_time.to_i
to = Date.new(*ARGV[2].split(',').map(&:to_i)).to_time.to_i
File.open(ARGV[0]).each_line do |line|
/: (?<timestamp>\d+)/ =~ line rescue next
puts line if timestamp.to_i.between?(from, to)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment