From: Jonathan Blake Date: Thu, 22 Feb 2018 23:44:28 +0000 (+0000) Subject: added a script to list bookcodes by subseries X-Git-Tag: 20180411~12 X-Git-Url: http://git.projectaon.org/?p=project-aon.git;a=commitdiff_plain;h=fa0028d21ffb5d56ca11c3c8003ceea2f4e1d326 added a script to list bookcodes by subseries git-svn-id: https://projectaon.org/data/trunk@2701 f6f3e2d7-ff33-0410-aaf5-b4bee2cdac11 --- diff --git a/common/scripts/list-bookcodes-by-subseries.sh b/common/scripts/list-bookcodes-by-subseries.sh new file mode 100755 index 0000000..450520d --- /dev/null +++ b/common/scripts/list-bookcodes-by-subseries.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# +# List all bookcodes that match given subseries. +# +# Example: +# list-bookcodes-by-subseries.sh lw gs + +if [ ! -d "$AONDIR" ]; then + >&2 echo "Please set the AONDIR environment variable" + exit 1 +fi + +book_db="$AONDIR/common/sqlite/bookcodes.db" + +for subseries in $@ +do + if [[ ! $subseries =~ ^[a-z]+$ ]]; then + >&2 echo "invalid subseries" + exit 1 + fi + + sqlite3 -column -noheader "$book_db" <