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

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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