Skip to content

Instantly share code, notes, and snippets.

@fiftin
Forked from HGebhardt/psql2sqlite.sed
Last active October 5, 2015 08:27
Show Gist options
  • Save fiftin/46937cdea7532991e98c to your computer and use it in GitHub Desktop.
Save fiftin/46937cdea7532991e98c to your computer and use it in GitHub Desktop.
Convert PostgreSQL data to SQLite
#! /bin/sed -f
# add begin transaction
1s/^SET .*$/END;\nBEGIN;\n/
1s/^-- .*$/END;\nBEGIN;\n/
1s/^/BEGIN;\n/
# remove configuration settings
/^SET /d
# remove comments
/^--/d
# remove sequence values
/^SELECT pg_catalog.setval/d
# add end transaction
$s/$/\nEND;\n/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment