Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE's and grep



<karina.popkova at verizon.net> writes:

> Now, what I really want to do
> is to search for general words
> that have a pattern, but also to 
> exclude a specific vowel or consonant.
> I.E., to make as a part of the search pattern
> that you call an RE, to look for given words
> and make sure that the vowel "a" or the
> vowel "e" is not a part of the word or string?

        grep 'pattern' file.dict | grep -v 'a'

        grep 'pattern' file.dict | egrep -v '(a|e)'

might be what you're looking for.

> How could you find all words in a file that do not
> have the letter: a, or e or i, and so on (???)
> Or do not have the letters a, and e, and i in the same word?

        egrep -v '(a|e|i)' file.dict

might be what you want.

Or do you mean 'a' *and* 'e' *and* 'i'.  If so, I'd write:

        perl -ne 'print if (!/a/ && !/e/ && !/i/)' file.dict


And for a laugh:

        grep cei /usr/dict/words | wc -l
        grep cie /usr/dict/words | wc -l

Regards,

--kevin
-- 
Kevin D. Clark / Cetacean Networks / Portsmouth, N.H. (USA)
cetaceannetworks.com!kclark (GnuPG ID: B280F24E)
alumni.unh.edu!kdc





BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org