Skip to content

Instantly share code, notes, and snippets.

/csv.rb Secret

Created April 17, 2014 12:43
Show Gist options
  • Save anonymous/95e132b11aa45b2dc1dd to your computer and use it in GitHub Desktop.
Save anonymous/95e132b11aa45b2dc1dd to your computer and use it in GitHub Desktop.
config = Hash.new
array = Dir.glob('configuration_*')
array.each do |f|
file = File.open(f ,"r")
lines = file.readlines
lines.each do |line|
if line.include? 'uid'
line.match(/(?=uid).*?[\'\"].*?[\'\"](.*?)[\'\"]/)
field, value = line.split("=",2);
(config[:uid] ||= []) << value
end
if line.include? 'url'
line.match(/(?=url).*?[\'\"].*?[\'\"](.*?)[\'\"]/)
field, value = line.split("=",2);
(config[:uid] ||= []) << value
end
if line.include? 'dbname'
line.match(/(?=dbname).*?[\'\"].*?[\'\"](.*?)[\'\"]/)
field, value = line.split("=",2);
config[:dbname] ||= [] << value
end
end
end
uid,"["" 'alliance';\n"", "" 'https://alliance.mydomain.net';\n"", ""'alliance';\n"", "" 'total';\n"", "" 'https://total.mydomain.net';\n"", ""'total';\n""]"
what i want is
uid,"["" 'alliance';\n"", "" 'https://alliance.mydomain.net';\n"", ""'alliance';\n"]
uid,"["" 'total';\n"", "" 'https://total.mydomain.net';\n"", ""'total';\n""]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment