Convert Windows 1Password 6 txt file to generic CSV file for importing in LastPass

The script finally works. Don’t try to use math to get the website address, I think every exported entry has a website=, so you don’t have to be smart to figure out which line website is on.

s = "url,type,username,password,hostname,extra,name,grouping\n"
users = []
pass = []
hostname = []
namey = []
tn = 0
stuff = []
File.open(ARGV[0], "r") {|f|
	f.each_line do |line|
		if line.start_with?("\r")
			tn = tn + 1
		else
			if stuff[tn].nil?
				stuff[tn] = line.to_s
			else
				stuff[tn] += line.to_s
			end
		end
	end
}
stuff.each { | itemy |
	if !itemy.nil?
		t = []
		t = itemy.split(/\n/)
		en = t.count - 1
		n = 0
		if t
			t.each { | bla |
				t2 = bla.split("=", 2)
				diff = en - n
				t2[0] = t2[0].to_s.gsub(/\r|\n/m, "")
				t2[1] = t2[1].to_s.gsub(/\r|\n/m, "")
				if n != 0
					if diff == 1 && t2[0] != "password"
						users[stuff.index(itemy)] = t2[1]
					elsif en == n && t2[0] != "username"
						pass[stuff.index(itemy)] = t2[1]
					elsif t2[0] == "website"
						hostname[stuff.index(itemy)] = t2[1]
					elsif n == 1
						namey[stuff.index(itemy)] = t2[1]
					end
				end
			n = n + 1
			}
	end
	end
}
n = 0
while n <= tn do
	if hostname[n].nil?
		if pass[n] == pass[n - 1]
			hostname[n] = hostname[n - 1]
			namey[n] = namey[n - 1]
		end
	end
	if "#{hostname[n]},,#{users[n]},#{pass[n]},#{hostname[n]},,#{namey[n]}," != ",,,,,,,"
		s += "#{hostname[n]},,#{users[n]},#{pass[n]},#{hostname[n]},,#{namey[n]},"
		s += "\n"
	end
	n = n + 1
end
File.open(ARGV[1], "w") {|f|
	f.write(s)
}
print "Saved #{tn} to #{ARGV[1]}\n"

There's the Ruby script to convert it. If it doesn't work, you can fix it. If you run it in Windows, use Bash. Or find a Windows build of Ruby.
Had to change my dediserve password, the password I imported didn't work. I deleted the txt file already, so I can't see what it is in there. Also uninstalled 1Password, and I'm not in Windows.
Don't use that script, Amazon password is wrong too. Has www.amazon.com instead of a password. Another password to reset.
No cPanel login for my BuyShared hosting. Tried resetting, but no email yet.
Don't use BuyShared, if you might lose the password. I had to go into Windows, and login to 1Password in Chrome, and copy the password. BuyShared disabled all email apparently.
The script doesn't like certain characters. You could try removing the .to_s.gsub.
LastPass's password generator blows. The password I copied and pasted, is wrong, can't login.
Update
Updated the code to limit the split to 2. That might fix it. I'm assuming the passwords that aren't all there, have an equals sign.