Script to fetch all shortcodes to CSV file.
authorRobin H. Johnson <rjohnson@sitka.bclibraries.ca>
Thu, 23 Feb 2012 02:50:51 +0000 (18:50 -0800)
committerRobin H. Johnson <rjohnson@sitka.bclibraries.ca>
Thu, 23 Feb 2012 02:50:51 +0000 (18:50 -0800)
marc_export_custom/fetch-shortcodes.sh [new file with mode: 0755]

diff --git a/marc_export_custom/fetch-shortcodes.sh b/marc_export_custom/fetch-shortcodes.sh
new file mode 100755 (executable)
index 0000000..fb8f6f4
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash 
+psql -Upostgres -U evergreen evergreen -h db1.bclibraries.ca -o shortcodes.csv \
+-c "COPY (
+      SELECT
+        a.shortname,a.name,b.shortname AS parent
+      FROM actor.org_unit a
+      JOIN actor.org_unit b
+        ON (a.parent_ou = b.id)
+      ORDER BY shortname
+    ) TO STDOUT WITH CSV HEADER QUOTE AS '\"' FORCE QUOTE shortname, name, parent;"
+