added code to catch error in timestamp

master
Jeff Yates 2020-11-22 15:58:47 -05:00
parent f02c088201
commit 1654510a0f
1 changed files with 7 additions and 2 deletions

View File

@ -152,8 +152,13 @@ def process_file (file_name, binfile, type)
sections = text.lines("Date and time:", chomp: true) #sections is an arrary of each date section from the text
sections.delete_at(0) #we can ignore the first chunk of text
sections.each do |chunk|
begin
timestamp = chunk.lines.delete_if {|line| line == "\r\n"}[0] #pulling out the timestamp
timestamp.tr!('/','-').tr!(':','').tr!(' ','_') #remove slashes and colons from timestamp, replaces spaces with unserscores
rescue
pp timestamp
abort
end
timestamp.strip!
output = Hash.new #Creating the output storage object
outfile = file_name + '_' + timestamp