- pgx_list_dbs: Lists the names of databases in an .sql file dumped using pg_dumpall.
- pgx_extract_db: Extracts a single database from a sql file dumped with pg_dumpall and outputs its content to stdout.
Download the (re)installer by doing:
sudo wget -O /usr/local/bin/pgx_installer \ https://gist.github.com/runekaagaard/7924963/raw/pgx_installer \ && sudo chmod +x /usr/local/bin/pgx_installer
Then run it with:
pgx_installer
Based on:
http://madssj.com/blog/2010/04/09/extracting-a-single-database-from-a-pg_dumpall-postgresql-dump/
Your code seems to have some errors:
root@db-1 backup]# sh extract_dbs.sh test123db testing.db
extract_dbs.sh: line 26: syntax error near unexpected token
<'done < <(grep -b '^\\\connect' "$db_file" | grep -m 1 -A 1 "$db_name$")'