Created
September 13, 2014 13:43
-
-
Save aont/4846d89a439213d57751 to your computer and use it in GitHub Desktop.
lastpass.csv -> csv for each site
This file contains hidden or 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
| #!/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