Last active
December 9, 2022 12:00
-
-
Save rustybird/3cd28096c640ff77c936cd72ba573ffd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# "Manage Bookmarks" (Ctrl-Shift-o) - "Import and Backup" - "Backup..." | |
# split-browser-bookmark-json2tsv <bookmarks-2022-03-04.json >>bookmarks.tsv | |
# (Conversion happens in a diposable qube, which must have jq installed.) | |
set -e -u -o pipefail | |
jq_filter='recurse(.children[]?) | | |
select(.typeCode==1) | | |
(.dateAdded | tostring) + "\t" + .uri + "\t" + (.title | gsub("[\t\n]"; " "))' | |
qvm-run-vm @dispvm "jq -r ${jq_filter@Q}" | | |
LC_ALL=C stdbuf -oL tr -c '\040-\176\t\n' _ | | |
grep -Ex $'[0-9]{15,16}(\t[^\t]+){2}' | | |
sort -sn | | |
uniq | | |
while IFS=$'\t' read -r microseconds url title; do | |
date=$(date --rfc-3339=seconds --date=@$(( microseconds / 1000000 ))) | |
printf '%s\t%s\t%s\n' "$date" "$url" "$title" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment