[Tutor] Grep equiv.

Wes Bateman wbateman@epicrealm.com
Thu, 31 Aug 2000 10:05:10 -0500 (CDT)


Hello all:

Sorry if this is a question I should have figured out on my own...but I
haven't :)  I've written only one useful Python script (which ran in sub 1
second, or approx. .2 seconds actually, versus another script doing the
same thing I wrote in BASH which took 52 seconds to run!  I'm sold :) )

Anyhow, I've been jumping through hoops trying to slice sections of
strings and use if comparrisons to do the same thing I used grep for in
BASH.

Is there a nice, easy, fast way of saying "if this
line/string/variable/array/whatever contains 'xxx' then do 'something'"

With something being spit it out, return true, or whatever.  Doesn't
matter.

Anyhow, thanks for any help :)

Wes
A struggling python beginner, trying to buck the system in a building full
of c, perl, awk, java, and other assorted programmers - none of whom use
python (yet ;) )