Query regarding grep!!

Nick Vatamaniuc vatamane at gmail.com
Tue Sep 26 04:32:29 EDT 2006


Of course you can always use grep as an external process (if the OS has
it). For example:

-------------------------------------------------------------------
In [1]: import subprocess

In [2]: out=subprocess.Popen( 'grep -i blah ./tmp/*',
stdout=subprocess.PIPE, shell=True ).communicate()[0]

In [3]: out
Out[3]: './tmp/ex.tex:Blah blah blah...\n'
-------------------------------------------------------------------

-Nick V.



bhavya sg wrote:
> Hi,
>
>  I saw in PEP4 of python 2.5 that grep module has gone
> obsolete in perl 2.5. But I am not able to find an
> alternative for that.My doubt is "are the other forms
> of grep like egrep and ggrep be used instead"?
>
> cheers,
> Spurthi
>
>
>
>
> __________________________________________________________
> Yahoo! India Answers: Share what you know. Learn something new
> http://in.answers.yahoo.com/




More information about the Python-list mailing list