I'm trying to capture SQL DDL "CREATE" from a PostgreSQL schema dump that looks like this:
SET default_table_access_method = heap;
CREATE TABLE schema_name.table_name (
col1 bigint,
col2 text
);
ALTER TABLE schema_name.table_name OWNER TO user;
CREATE INDEX index ON schema_name.table_name USING btree (col1);
What I want is:
CREATE TABLE schema_name.table_name (
col1 bigint,
col2 text
);`
Why grep -Po "(CREATE TABLE)[\S\s]*(;)" dump.sql is not working?
In PCRE2 /CREATE TABLE [\w]*\.[\w]*[\S\s]*(;)/U matches properly.
thanks.