Skip to content

Instantly share code, notes, and snippets.

@jonespm
Created October 21, 2014 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonespm/cf87b61c4c117063e224 to your computer and use it in GitHub Desktop.
Save jonespm/cf87b61c4c117063e224 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Run like
# mvn com.ning.maven.plugins:maven-duplicate-finder-plugin:1.0.9:check > duplicates.txt
# cat duplicates.txt| ./duplicateparse.rb > parsedoutput.txt
tool=""
toolh=Hash.new
ARGF.each do |line|
#print line without the new line if line does not contain /--+/
if (line =~ /\[INFO\] Building (.*)/)
#New tool
tool=Regexp.last_match(1)
toolh[tool] = Hash.new
end
if (line =~/\[WARNING\] Found duplicate/)
toolh[tool][line] = 1
end
end
toolh.each do |hash,key|
if !key.empty?
puts hash
key.each do |h,k|
puts "\t#{h}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment