Keyscrape to SQLite converter

Keyscrape to SQLite converter

An awk script used to convert colon-delimited files from keyscrape into SQLite code.

Use it in the following way:

weewiki keyscrape > keys.txt
./keys2db < keys.txt | sqlite3 keys.db

<<keys2db>>=
#!/usr/bin/awk -f
BEGIN {
    FS=":"
    print("DROP TABLE IF EXISTS keywords;")
    print("CREATE TABLE keywords(page TEXT, keyword TEXT, line INTEGER);")
    print("BEGIN;");
}

{
    print "INSERT INTO keywords(page, keyword, line) " \
    "VALUES(\""$1"\",\""$2"\","$3");"
}
END {
    print("COMMIT;");
}