Loading ...
Sorry, an error occurred while loading the content.

Re: How to do this?

Expand Messages
  • andalou
    ... Regards, Cesar --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_use maillist. For more information, visit
    Message 1 of 13 , Mar 1, 2009
    • 0 Attachment
      On Mar 1, 12:40 pm, andalou <cesar.rom...@...> wrote:
      > On Mar 1, 11:46 am, vimlover <dawangsh...@...> wrote:
      >
      >
      >
      > > Hello,
      >
      > > I have hundreds of rows in a files like:
      >
      > > ALTER TABLE "PCDTST"."ACCOUNTINGSTATUS" ADD CONSTRAINT
      > > "PK_ACCOUNTINGSTATUS" PRIMARY KEY ("ACCOUNTINGSTATUS") USING INDEX PCTFREE
      > > 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST
      > > GROUPS 1) TABLESPACE "PESDBO_INDEXES" LOGGING ENABLE ;
      >
      > > how can I change to: (just delet 'USING' clause till ';' in each line)
      >
      > > ALTER TABLE "PCDTST"."ACCOUNTINGSTATUS" ADD CONSTRAINT
      > > "PK_ACCOUNTINGSTATUS" PRIMARY KEY ("ACCOUNTINGSTATUS");
      >
      > > Thank you
      > > vimlover
      >
      > > --
      > > View this message in context:http://www.nabble.com/How-to-do-this--tp22274905p22274905.html
      > > Sent from the Vim - General mailing list archive at Nabble.com.
      >
      > :%s/ USING.*/
      >
      > Regards,
      > Cesar

      I've forgotten something:
      :%s/ USING.*/;

      Regards,
      Cesar
      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • vimlover
      Thank you all very much for help. Regards vimlover ... -- View this message in context: http://www.nabble.com/How-to-do-this--tp22274905p22276291.html Sent
      Message 2 of 13 , Mar 1, 2009
      • 0 Attachment
        Thank you all very much for help.
        Regards
        vimlover




        StarWing wrote:
        >
        >
        >
        >> I have hundreds of rows in a files like:
        >>
        >> ALTER TABLE "PCDTST"."ACCOUNTINGSTATUS" ADD CONSTRAINT
        >> "PK_ACCOUNTINGSTATUS" PRIMARY KEY ("ACCOUNTINGSTATUS") USING INDEX
        >>  PCTFREE
        >> 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1  FREELIST
        >> GROUPS 1) TABLESPACE "PESDBO_INDEXES" LOGGING ENABLE ;
        >>
        >> how can I change to: (just delet 'USING' clause till ';' in each line)
        >>
        >> ALTER TABLE "PCDTST"."ACCOUNTINGSTATUS" ADD CONSTRAINT
        >> "PK_ACCOUNTINGSTATUS" PRIMARY KEY ("ACCOUNTINGSTATUS");
        >
        > maybe
        > :%s/USING \zs[^;]\ze;//g
        >
        > or
        > :%s/USING \zs.\{-}\ze\s*;\s*$//g
        >
        > you can choose one for try...
        > >
        >
        >

        --
        View this message in context: http://www.nabble.com/How-to-do-this--tp22274905p22276291.html
        Sent from the Vim - General mailing list archive at Nabble.com.


        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Tony Mechelynck
        ... Due to zs, the above won t remove the USING word itself. The command ... will delete everywhere from USING (included) to the _first_ following semicolon
        Message 3 of 13 , Mar 2, 2009
        • 0 Attachment
          On 01/03/09 18:41, StarWing wrote:
          >
          >> I have hundreds of rows in a files like:
          >>
          >> ALTER TABLE "PCDTST"."ACCOUNTINGSTATUS" ADD CONSTRAINT
          >> "PK_ACCOUNTINGSTATUS" PRIMARY KEY ("ACCOUNTINGSTATUS") USING INDEX PCTFREE
          >> 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST
          >> GROUPS 1) TABLESPACE "PESDBO_INDEXES" LOGGING ENABLE ;
          >>
          >> how can I change to: (just delet 'USING' clause till ';' in each line)
          >>
          >> ALTER TABLE "PCDTST"."ACCOUNTINGSTATUS" ADD CONSTRAINT
          >> "PK_ACCOUNTINGSTATUS" PRIMARY KEY ("ACCOUNTINGSTATUS");
          >
          > maybe
          > :%s/USING \zs[^;]\ze;//g
          >
          > or
          > :%s/USING \zs.\{-}\ze\s*;\s*$//g
          >
          > you can choose one for try...

          Due to \zs, the above won't remove the USING word itself.

          The command

          :%s/\<USING\>\_.\{-}\ze;//g

          will delete everywhere from USING (included) to the _first_ following
          semicolon (excluded) regardless of how many or how few intervening
          linebreaks there might be. USING must be present as a separate word:
          something like HOUSING won't trigger the substitute.

          Note the use of:
          \< start of word
          \> end of word
          \_. anything including a linebreak
          \{-} 0 or more, as few as possible
          \ze the replaceable match ends here
          g flag any number of times on a line

          This assumes that quoted semicolons (which we must skip) won't happen
          among the operands of USING.


          Bestregards,
          Tony.
          --
          Toilet Toupee, n.:
          Any shag carpet that causes the lid to become top-heavy, thus
          creating endless annoyance to male users.
          -- Rich Hall, "Sniglets"

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        Your message has been successfully submitted and would be delivered to recipients shortly.