Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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.

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: keepass.info/help/base/importexport.html#csv –  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. –  Ellesa 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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