1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Firefoxのブックマークをシェルで分析する

Posted at

ほんとうはタグクラウドのアドオンを自作したかったんですが、Firefoxのプラグインのつくりかたがよくわからなかったのでとりあえずシェルでやってみることにしました。

ブックマーク > すべてのブックマークを表示 > ☆ > バックアップ でJSONとしてブックマークをエクスポートできる。

タグがそれぞれ何回ずつ使われているか集計する

tagcount.sh
# !/bin/sh

#
# usage:
#   cat bookmarks-2018-08-24.json | ./tagcount.sh
#

jq .              |
grep '^ *"tags"'  |
sed 's/^ *//g'    |
cut -d ' ' -f 2-  |
sed 's/^"//'      |
sed 's/",$//'     |
tr ',' '\n'       |
sort              |
uniq -c           |
sort -rn

jqがはいっていなければいれます。

jqのインストール
brew update
brew install jq

ブックマークのJSONはパイプで渡します。

実行
cat bookmarks-2018-08-24.json | ./tagcount.sh | head -n 20
 353 hoge
 320 Web1.0
 292 読み物
 154 Raspberry Pi
 149 rails
 143 ruby
  95 android
  93 blog
  91 Arduino
  89 fashion
  88 design
  84 wifi
  84 old computer
  72 art
  72 OpenData
  69 マンガ
  68 ポケコン
  68 iOSアプリ開発
  65 IoT
  63 Akiba

fashion design art とかが上位にきてるのが意外でした。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?