- Download the script locally (button above)
- Copy names into a .txt file called input.txt in the same directory as the script
cd
into the dir with terminal- run
ruby titlecase_lines.rb
- Copy from input.txt back into excel
Hope this works for you.
#!/usr/bin/env ruby | |
new_lines = [] | |
File.open("input.txt", "r+") do |f| | |
f.each do |l| | |
title_name = l.gsub(/\w+/) do |word| | |
word.capitalize | |
end | |
new_lines << title_name | |
end | |
f.rewind | |
new_lines.each do |l| | |
f.puts l | |
end | |
end |