Created
September 21, 2014 22:40
-
-
Save maxwofford/1654a998dd59148af68a to your computer and use it in GitHub Desktop.
Replace key words in a file
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
# Replaces words in input.txt | |
# Takes arguments in the format foo='bar' | |
input = File.open('input.txt', "w") | |
ARGV.each do |i| | |
variable_name = i.to_s.split('=')[0] | |
contents = .to_s.split('=')[1] | |
input.gsub(variable_name, contents) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment