Created
April 29, 2014 00:22
-
-
Save ChangJoo-Park/11387797 to your computer and use it in GitHub Desktop.
로그에서 JAVA 부분만 추려서 파일로 쓰고 노트패드를 연다
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ARGV[0] != nil | |
originFile = ARGV[0] | |
contentsArray = IO.readlines(originFile) | |
currentTime = Time.now.strftime("%Y-%m-%d-%H-%M-%S") | |
targetFile = "#{ARGV[0]}_#{currentTime}.txt" | |
resultFile = File.open(targetFile, "w") | |
contentsArray.each do |line| | |
if (line =~ /JAVA/) | |
resultFile.write(line) | |
end | |
end | |
resultFile.close | |
system("notepad #{targetFile}") | |
else | |
puts "input log file name argument 0" | |
puts "example : ruby logfinder.rb (filename)" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment