added code to catch error in timestamp
parent
f02c088201
commit
1654510a0f
|
@ -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 = 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.delete_at(0) #we can ignore the first chunk of text
|
||||||
sections.each do |chunk|
|
sections.each do |chunk|
|
||||||
timestamp = chunk.lines.delete_if {|line| line == "\r\n"}[0] #pulling out the timestamp
|
begin
|
||||||
timestamp.tr!('/','-').tr!(':','').tr!(' ','_') #remove slashes and colons from timestamp, replaces spaces with unserscores
|
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!
|
timestamp.strip!
|
||||||
output = Hash.new #Creating the output storage object
|
output = Hash.new #Creating the output storage object
|
||||||
outfile = file_name + '_' + timestamp
|
outfile = file_name + '_' + timestamp
|
||||||
|
|
Loading…
Reference in New Issue