Skip to content

Instantly share code, notes, and snippets.

@HugoDF
Last active January 14, 2016 13:58
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 HugoDF/19ab013420b5c3c30f41 to your computer and use it in GitHub Desktop.
Save HugoDF/19ab013420b5c3c30f41 to your computer and use it in GitHub Desktop.
If you have a citations.txt file with one URL per citation (eg. Word citations) and need to open them up without clicking through the menu
# use like so:
# ruby citations.rb "text_to_match_1" "text_to_match_2"
args = ARGV
counter = 0
File.open('./citations.txt', 'r') do |f|
while line = f.gets
args.each do |a|
if line.downcase.include?a.downcase
starts_with = "http"
system('open ' + starts_with + line.split(starts_with).last)
puts starts_with + line.split(starts_with)[1]
end
end
end
counter += 1
end
puts counter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment