Wrote some ruby scripts to help with restore
[backups/.git] / scripts / list-dates.rb
1 #!/usr/bin/ruby
2
3 # Make sure the record separator is zero rather than new-line
4 $/ = "\0"
5
6 # Create a set of backup dates
7 require 'set'
8 dates = SortedSet.new
9
10 # Split each input record into 8 fields on spaces and grab the 7th as integer
11 date_array = ARGF.map { |rec| rec.split( ' ', 8 )[6].to_i }
12
13 # Merge the dates into the set
14 dates.merge date_array
15
16 # Output the sorted set
17 puts dates.to_a