
Pattern Match - substitute a string after the match
Hi,
I am trying to automate a table creation process... As an example, I
have a huge file called tables.txt. I want to match the table
"ACCOUNTS" and then substitute the INITIAL 131072 and NEXT 131072 to
INITIAL 1M and NEXT 1M. This has to happen just in the "ACCOUNTS"
block.
Each block in the file starts with CREATE and ends with a slash /.
Does anyone have an example of how can I accomplish this? Any help is
appreciated.
tables.txt sample ->
CREATE TABLE "ACCOUNTING_ROLE"
( "ROLE_CODE" VARCHAR2(15),
"ROLE_DESC" VARCHAR2(30),
"ROLE_TYPE" VARCHAR2(2)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TEST"
/
CREATE TABLE "ACCOUNTS"
( "ACCOUNT_ID" VARCHAR2(8),
"MAINT_FLAG" VARCHAR2(1),
"STATUS" VARCHAR2(1),
...
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TEST"
/
...
....
.....
Thanks.