[NTLUG:Discuss] VI editor commands

Rusty Haddock rusty at fe2o3.lonestar.org
Thu May 22 02:57:50 CDT 2003


Rusty Haddock wrote:
    >jay linux wrote:
    >    >I'm refamiliarizing myself with the VI editor after a long, long time....
    >    >
    >    >Can anyone tell how I can:
    >    >
    >    >1) Find all words that start and end with a vowel.
    >
    >	/\<[aeiou][a-z]*[aeiou]\>
    >
    >Depends somewhat on yer definition of a "word".  Also, I tend to
    >run with :set ignorecase so you may need to adjust to account for
    >this (or turn it on like me :-).  The above search command would
    >require yer "word" to be at least two letters and contain nothing
    >but alphabetics.  This should work with old versions of 'vi'.
    >
    >If single letters, such as A and I, appeal to you as words in this
    >context then you'll need to use this:
    >
    >	/\<[aeiou]\([a-z]*[aeiou]\)*\>

Minor correction here: Please replace that last '*' with a "\?".

The former version will get you what you want and work in older Vi's
(like on Solaris) but will probably make the machine work harder for
it. :-)  Using the "\?" is the better solution but I think it's only
in Vim.  FWIW... 

Oh, you might want to add a 'y' to the vowels, at least in the
second set.   Your call. :-)

	-Rusty-
-- 
   _____        Rusty Haddock  =  KD4WLZ  =  rusty at fe2o3.lonestar.org
|\/   o \   o  **Out yonder in the Van Alstyne (TX) Metropolitan Area**
|   (  -<  O o   The day Microsoft makes something that doesn't suck
|/\__V__/           is the day they start making vacuum cleaners.



More information about the Discuss mailing list