Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for people who can recommend a good strategy into converting my passwords.rtf file into KeePass. My passwords.rtf document looks like this and contains about 70 entries, so manual entry seems like building the 4th bridge. (Replace with better idiom)


Customer Number: smt
Customer Password: smt


Username: smt
pass: smt

EA Sports
User: smt
Pass: smt

Is there anything I can do to speed up the importing process?

share|improve this question

KeePass can import from CSV, so export from RTF to text (to remove the bold and other formatting), then use something like Perl (or your favourite scripting language) to convert to CSV.

Perl is very good for this, but it probably isn't worth learning Perl just to convert 70 records.

c:\> perl -00 -n -e "print join('|', split(qq(\n),$_)), qq(\n)' pw.txt


c:\>  perl -00 -p -e "chop; s/\n(.)/|$1/g"  pw.txt


vBulletin|Customer Number: smt|Customer Password: smt
APC|Username: smt|pass: smt
EA Sports|User: smt|Pass: smt

But needs adjusting to whatever KeePass specifies for CSV layout.

share|improve this answer
Good solution, but CSV ("comma-separated value") format normally uses commas instead of pipes. The strings will also need ot be normalized by removing .+:\s from the beginning of each username or password line. KeePass in particular requires each field to be enclosed in quotes (and any quotation marks in a field value must be escaped). KeePass CSV format: – rob Jun 16 '11 at 18:37
Furthermore, when you import CSVs into KeePass, the wizard will give you the opportunity to arrange the items and have them correspond with KeePass fields; you don't have to worry about how your CSV is arranged. Just make sure you have at least 2 fields for each item in your CSV: username and password. – Kaze Jun 16 '11 at 18:40
up vote 0 down vote accepted

Thanks a lot RedGrittyBrick! That was helpful.

perl -00 -nle 'print join ",", split /\n/' passwords.txt

This did the trick for me, while your second script seemed to remove first character at ports, EA Sports|ser: smt|ass: smt. Thanks, you helped me a long way!

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .