Skip to content

Instantly share code, notes, and snippets.

@jph
Created May 6, 2013 07:42
Show Gist options
  • Save jph/5523842 to your computer and use it in GitHub Desktop.
Save jph/5523842 to your computer and use it in GitHub Desktop.
require 'csv'
csv = CSV.read "ips.csv"
config = []
csv.each_with_index do |row,index|
config << "Dest#{index}=#{row[0].gsub(/ /,'')}-#{row[3].gsub(/ /,'')}-#{row[2]}"
end
puts config.join "\r\n"
require 'csv'
csv = CSV.read "ips.csv"
hosts = []
csv.each do |row|
hosts << "#{row[1]} #{row[0].gsub(/ /,'')}-#{row[3]}-#{row[2]}"
end
puts hosts.join "\r\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment