💾 Archived View for lyk.so › bookmarks.gmi.sh captured on 2024-05-10 at 10:46:10.

View Raw

More Information

⬅️ Previous capture (2023-06-16)

-=-=-=-=-=-=-

#!/usr/bin/env sh

target="$(dirname $0)/bookmarks.gmi"

cat > $target <<EOF
# bookmarks

=> bookmarks.gmi.sh Generated with this script.

These are the pages I have bookmarked in Lagrange as of $(date -uI), sorted alphabetically by title.

EOF

# awk processes files line-by-line. NR is a global variable containing the
# current line number. Any line in an awk script that evaluates to true
# implicitly means "print the line as-is." This script skips every third line,
# prints the line before every third line as-is, and prints the third column of
# each line before *that* with a '=> ' prepended and a ' ' appended, with no
# line break after.
awk '
  (NR % 3) == 2
  (NR % 3) == 1 {
    printf "=> " $3 " "
  }
' ~/.config/lagrange/bookmarks.txt | sort -k 3,3 | uniq >> $target