Skip to content

Instantly share code, notes, and snippets.

@salif
Created February 22, 2022 23:37
Show Gist options
  • Save salif/6bbc0d5ff4f40b8d41eafd0cf52efa29 to your computer and use it in GitHub Desktop.
Save salif/6bbc0d5ff4f40b8d41eafd0cf52efa29 to your computer and use it in GitHub Desktop.
Get JSON with all words from pbd171.db
const words = require('./temp.json')
const fs = require('fs')
for (let i = 0; i < words.length; i+=1904) {
const lcode = 'word_'+words[i].lan_code
for (let j = 0; j < 1904; j++) {
words[j][lcode] = words[i+j].word
}
}
for (let j = 0; j < 1904; j++) {
delete words[j]['word']
delete words[j]['lan_code']
}
fs.writeFile('words.json', JSON.stringify(words.slice(0, 1904)), 'utf8', console.log)
sqlite3 -json pbd171.db "select * from tblWords" > temp.json
node get_json.js
@salif
Copy link
Author

salif commented Feb 22, 2022

Run script.bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment