Created
October 8, 2008 21:29
-
-
Save stevej/15603 to your computer and use it in GitHub Desktop.
For a big file filled with atom entries, spit out the epoch of each atom entry's updated timestamp. Output to stdout. so pipe it to your file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# usage: ./atom_timeseries.rb file | |
# For a big file filled with atom entries, spit out | |
# the epoch of each atom entry's updated timestamp. | |
# Output to stdout. so pipe it to your file. | |
require 'Time' | |
file = File.new(ARGV[0], "r") | |
while (line = file.gets) | |
if line =~ /<updated>(.*)<\/updated>/ | |
puts Time.parse((/<updated>(.*)<\/updated>/.match(line))[1]).to_i | |
end | |
end | |
file.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment