>> CREATE TABLE "HCDCNV"."ADDR_AGREEMENT" ("AGREEMENT_ID" NUMBER,
>> "AGREEMENT_CODE" VARCHAR2(64) NOT NULL ENABLE, "AGREEMENT_EFF" DATE
>> NOT NULL ENABLE, "CRTN_DT_TMSTMP" DATE NOT NULL ENABLE, "IS_VALID"
>> VARCHAR2(1) NOT NULL ENABLE, "CRTN_LGN_ID" VARCHAR2(20) NOT NULL
>> ENABLE, "MDFD_DT_TMSTMP" DATE NOT NULL ENABLE, "MDFD_LGN_ID"
>> VARCHAR2(20) NOT NULL ENABLE) PCTFREE 10 PCTUSED 80 INITRANS 1
>> MAXTRANS 255 STORAGE(INITIAL 1048576 FREELISTS 1 FREELIST GROUPS 1)
>> TABLESPACE "CONVTABLES" LOGGING NOCOMPRESS ;
>>
>> so how can I extract only those 'CREATE TABLE....' clause till ';'
>> from this file and save it to a new file, say '2.sql'
>
> I try to use
> g/^CREATE TABLE/,/;/ w!>> 2.sql
>
> Vim shows:
> E486: Pattern not found: ^CREATE TABLE
It works for me. Perhaps your CREATE TABLE is not truly at the
beginning of the line. You may need to change your pattern slightly if
it isn't. E.g. to allow whitespace before it:
/^\s*CREATE TABLE/
Note that your syntax also assumes that your ';' is at the end of a
line. If it isn't, the rest of the line also will be written to the
file, because the :w command (as all Ex commands) works with whole
lines.
Ben.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---