shell/gawk script (for prices I stored in Private Comments)

DiscussãoHacking LibraryThing

Aderi ao LibraryThing para poder publicar.

shell/gawk script (for prices I stored in Private Comments)

Este tópico está presentemente marcado como "adormecido"—a última mensagem tem mais de 90 dias. Pode acordar o tópico publicando uma resposta.

Ago 26, 2015, 4:28pm

This post isn't about a GreaseMonkey or Stylish script, but I thought it was germane to this group anyway, and I was proud of it too (my first time messing making a shell script and messing with (g)awk, woohoo!), so I thought I'd show it off / share it. Who knows, maybe others will find it (well, a customization of it) useful too. It does require running stuff on a *nix command line though.

As I've been cataloging, I've tried to make a note of the price I paid for each book in its Private Comment field. I wanted to be able to add up how much I've spent total on books (well, with some extrapolation, since I didn't record this for every book). I made a shell script to help me. There's more about it on this wiki page (including a link to it and a sample output).

It processes the Private Comment field of the .tsv export to look for amounts, converts some from other currencies, adds them all up, spits out some totals and averages, and, the fanciest part, spits out a histogram showing how many books were bought per dollar increment, e.g.:
$04.01-$05: ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 168
$05.01-$06: ■■■■■■■■■■■■■■■■■■■■■■■■■■■ 135
$06.01-$07: ■■■■■■■■■■■■■■■■■■■■■■■■■ 123