On Monday 26 January 2004 16:10, Jay Lee wrote:
> Great! I've been looking for something just like this myself as
> I'd love to move to MySQL from the flat .pref and .abook files. Do you
> have them on a website or did you mean to attach them?
you're right, I forgot to attach the file... here they are!
Nino
*.abook to SQL and *.pref to SQL
Quick & dirty conversion commands using bash
First prepare MySQL: create the database and tables according to
doc/db-backend.txt. Then cd to your /data/ -dir and generate
the ABOOK.SQL with the following command line mini-script (one line!):
for f in *.abook; do user=${f%.abook}; cat $f | sed -e s/^/insert\ into\ address\
values\ \(\'$user\'\,\ \'/ -e s/\|/\'\,\ \'/ -e s/\|/\'\,\ \'/ -e s/\|/\'\,\ \'/ -e
s/\|/\'\,\ \'/ -e s/$/\'\)\;/ >> ABOOK.SQL; done
Then just open the MySQL client and populate the address table by executing
ABOOK.SQL. Looks something like
mysql>\. ABOOK.SQL
Next, cd just above your data-dir and convert *.pref to PREF.SQL:
grep "=" data/*.pref | sed -e s/data\\//insert\ into\ userprefs\ values\ \(\'/ -e
s/\.pref:/\',\ \'/ -e s/\=/\',\ \'/ -e s/$/\'\)\;/ > PREF.SQL
and again, populate MySQL by executing PREF.SQL
Don't forget to remove the generated *.SQL-scriptfiles thereafter!
Done :-)