Hi,
I've also posted this in the UNIX scripting forum but thought it may be more appropriate here.
I'm struggling a bit with the following problem. I've tried awk and sed but can't get a solution.
I have a file containing text similar to the following (although I have cut bits out to fit it on this page)
NOT NULL, "PAGEHEIGHT" NUMBER(10, 0) NOT NULL) PCTFREE
40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 20480 NEXT
1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1
REM FREELIST GROUPS 1) TABLESPACE "FIN_CODAT" ;
REM ... 2 rows
CONNECT CUST_TEST;
CREATE UNIQUE INDEX "CUST_TEST"."OAS_ASM_INDEX1" ON "OAS_ASM" ("CODE" )
PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE (INITIAL 20480 NEXT 20480
MINEXTENTS 1 MAXEXTENTS 2147483645 ;
What I need to do it replace the text, accross multiple lines, between the word "PCTFREE" and the next occuring ";" with another string, although I would want to keep semi colon ";"
e.g. Replacing the text with the word DOG would give me
NOT NULL, "PAGEHEIGHT" NUMBER(10, 0) NOT NULL) DOG ;
REM ... 2 rows
CONNECT CUST_TEST;
CREATE UNIQUE INDEX "CUST_TEST"."OAS_ASM_INDEX1" ON "OAS_ASM" ("CODE" )
DOG ;
I have managed this with sed when the text I want to replace only spans 2 lines but not when it spans more than 2 lines.
Any help with this would be greatly appreciated.
Thanks, Matt.
I've also posted this in the UNIX scripting forum but thought it may be more appropriate here.
I'm struggling a bit with the following problem. I've tried awk and sed but can't get a solution.
I have a file containing text similar to the following (although I have cut bits out to fit it on this page)
NOT NULL, "PAGEHEIGHT" NUMBER(10, 0) NOT NULL) PCTFREE
40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 20480 NEXT
1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1
REM FREELIST GROUPS 1) TABLESPACE "FIN_CODAT" ;
REM ... 2 rows
CONNECT CUST_TEST;
CREATE UNIQUE INDEX "CUST_TEST"."OAS_ASM_INDEX1" ON "OAS_ASM" ("CODE" )
PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE (INITIAL 20480 NEXT 20480
MINEXTENTS 1 MAXEXTENTS 2147483645 ;
What I need to do it replace the text, accross multiple lines, between the word "PCTFREE" and the next occuring ";" with another string, although I would want to keep semi colon ";"
e.g. Replacing the text with the word DOG would give me
NOT NULL, "PAGEHEIGHT" NUMBER(10, 0) NOT NULL) DOG ;
REM ... 2 rows
CONNECT CUST_TEST;
CREATE UNIQUE INDEX "CUST_TEST"."OAS_ASM_INDEX1" ON "OAS_ASM" ("CODE" )
DOG ;
I have managed this with sed when the text I want to replace only spans 2 lines but not when it spans more than 2 lines.
Any help with this would be greatly appreciated.
Thanks, Matt.