Skip to content

Instantly share code, notes, and snippets.

@nono
Created January 29, 2010 14:42
Show Gist options
  • Select an option

  • Save nono/289765 to your computer and use it in GitHub Desktop.

Select an option

Save nono/289765 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Author: Bruno Michel <[email protected]>
# Copyright 2010 (c) af83
# Licence: MIT http://www.opensource.org/licenses/mit-license.php
# Parse the given log files and extract the list of URL
if ARGV.empty?
puts "Usage: #{$0} <logfiles>"
exit 1
end
require 'set'
urls = Set.new
ARGV.each do |filename|
File.open(filename).each_line do |line|
if line =~ /^Completed .* 200 OK \[(.*)\]$/
urls << $1.split('?').first
end
end
end
urls.sort.each { |url| puts url }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment