From fa0028d21ffb5d56ca11c3c8003ceea2f4e1d326 Mon Sep 17 00:00:00 2001 From: Jonathan Blake Date: Thu, 22 Feb 2018 23:44:28 +0000 Subject: [PATCH] added a script to list bookcodes by subseries git-svn-id: https://projectaon.org/data/trunk@2701 f6f3e2d7-ff33-0410-aaf5-b4bee2cdac11 --- common/scripts/list-bookcodes-by-subseries.sh | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 common/scripts/list-bookcodes-by-subseries.sh 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" <