recalculate offset for some filter
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 13 Apr 2022 17:33:12 +0000 (19:33 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 13 Apr 2022 17:33:12 +0000 (19:33 +0200)
gnuplot/calc-offset-filter.sh [new file with mode: 0755]

diff --git a/gnuplot/calc-offset-filter.sh b/gnuplot/calc-offset-filter.sh
new file mode 100755 (executable)
index 0000000..d07cc5f
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+grep $1 ~/zc/subvision-numbers.txt | awk '{ print $2 }' > /tmp/pn.filter
+shift
+
+interval="1 day"
+test ! -z "$1" && interval="$*"
+
+cat calc-offset.sql | sed "s/90 days/$interval/" | psql -A -t -F' ' zc | grep -f /tmp/pn.filter > offset.txt.new
+grep -v -f /tmp/pn.filter offset.txt > offset.txt.partial
+cat offset.txt.partial offset.txt.new > offset.txt
+