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

CharlasHacking LibraryThing

Únete a LibraryThing para publicar.

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

1omargosh
Ago 26, 2015, 4:28 pm

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

2bnsmith
Jun 21, 2022, 9:49 am

>1 omargosh: The link to your wiki does not seem to work?

3norabelle414
Jun 21, 2022, 9:53 am

>2 bnsmith: The wiki URL was changed a few years ago. For old links you'll need to change "https://www.librarything.com/wiki" to "https://wiki.librarything.com" so in this case https://www.librarything.com/wiki/index.php/User:Omargosh/bookcosts needs to be changed to https://wiki.librarything.com/index.php/User:Omargosh/bookcosts

4bnsmith
Jun 21, 2022, 10:54 am

Thanks!