olejorgenb / ColorNote-backup-decryptor

Decrypt a ColorNote backup file to export your notes (https://www.colornote.com)
MIT License
52 stars 9 forks source link

Other way to clean the output #5

Open BaptisteRichard opened 2 years ago

BaptisteRichard commented 2 years ago

I´m using Linux tr fucntion to remove any non-printable characters from the output, then replace any characters between json entites with a comma and add the brackets to make the final output a list of json objects

infile=out.json 
outfile=notes.json
tr -c '[:print:]\t\r\n' '[ *]' < $infile | sed -e 's/}[^{]*{/},{/g' | sed -e 's/}.{/},{/g' | sed -e 's/^[^{]*{/[{/' > $outfile ; echo ']' >> $outfile

Hope it can help someone :)