Skip to content

Instantly share code, notes, and snippets.

@aont
Created September 13, 2014 13:43
Show Gist options
  • Select an option

  • Save aont/4846d89a439213d57751 to your computer and use it in GitHub Desktop.

Select an option

Save aont/4846d89a439213d57751 to your computer and use it in GitHub Desktop.
lastpass.csv -> csv for each site
#!/usr/bin/ruby
require 'csv'
require 'uri'
CSV.foreach("lastpass.csv") do |row|
url=row[0]
username=row[1]
password=row[2]
name=row[3]
grouping=row[4]
fav=row[5]
if url !="url"
# p row
uri=URI::parse(url)
host = ""
host = uri.host if uri.host
path = ""
path = uri.path.chomp("/").gsub("/","_") if uri.path
p
outfn = host + path + ".csv"
File::open(outfn, "w") do |f|
for i in 0..5
f.puts row[i]
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment