1

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)

Kruidvat
smt
smt

vBulletin
Customer Number: smt
Customer Password: smt

Paysite
smtasdf

APC
Username: smt
pass: smt

EA Sports
User: smt
Pass: smt

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

2 Answers 2

1

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

or

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

Output:

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

But needs adjusting to whatever KeePass specifies for CSV layout.

2
  • 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: keepass.info/help/base/importexport.html#csv
    – rob
    Jun 16, 2011 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.
    – Ellesa
    Jun 16, 2011 at 18:40
0

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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.