You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ecsonar/test.rb

18 lines
482 B

4 years ago
File.open('error.csv', 'a+') do |f|
File.open('out.log').each do |line|
if line.start_with? "检测出错"
m = /检测出错: (.*), 原因: (.*)/.match(line)
puts "\"\",\"#{m[1]}\",\"#{m[2]}\""
f.puts "\"\",\"#{m[1]}\",\"#{m[2]}\""
elsif line.start_with? "未发现附件"
m = /(.+?)Person{uid='(.*)', name='(.*)', downloadUrl=''}/.match(line)
puts "\"#{m[2]}\",\"#{m[3]}\",\"#{m[1]}\""
f.puts "\"#{m[2]}\",\"#{m[3]}\",\"#{m[1]}\""
end
end
end