Last active
January 14, 2016 13:58
-
-
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
This file contains hidden or 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
# 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