Skip to content

Instantly share code, notes, and snippets.

@hydra35
Created August 15, 2012 04:07
Show Gist options
  • Save hydra35/3355765 to your computer and use it in GitHub Desktop.
Save hydra35/3355765 to your computer and use it in GitHub Desktop.
parse raw bash histroy
file = ARGV[0]
File.readlines(file).each do |line|
if /^#(\d+)/.match(line)
ts = Regexp.last_match(1)
print Time.at(ts.to_i).to_s + " "
else
puts line
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment