>alter table a1 enable constraints xxx;
>alter table b1 enable constraints xxx;
>alter table c1 enable constraints xxx;
>I know if I want to search pattern "a1", and, move the line (with this
>pattern) to end of file by using
>:g/a1/m$
>but if if want to search a couple of patterns, for example,like a1 and
b1,
>and move to the end of files,
>how can I do?

Why not

        :g/[abc]1/m$

if you're guaranteed those patterns are unique to the lines you want to
get?

If you want discrete labels only, eg, "a1", "b3", "c5", etc., ie, those
that don't fit a particular regexp pattern, then

        :g/a1\|b3\|c5\|.../m$   ("..." meaning "etc.", not taken
literally)

will do it.


Quick example, if I have a bunch of webpages where I want to get rid of
the prepended paths to each image, .js file, etc., and they fit the
pattern

        wu1_files/imageX.jpg    in file 'wu1.html'
        wu3_files/imageY.jpg    in file 'wu2.html'

etc., I'll edit the whole clump of files in one shot, then do

        :argdo g/wu[0-9]_files\//s///g

to get rid of them and leave just

        imageX.jpg
        imageY.jpg

respectively.  Where those files wouldn't fit the 'wu\d' pattern, I
would have to do something like a generic

        :argdo g/[a-zA-Z0-9]*_files\//s///g

or more specific

        :argdo g/name1_files\/\|name2_files\//s///g

instead.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to