search files in a directory

bruno at modulix onurb at xiludom.gro
Fri Apr 21 05:11:54 EDT 2006


Gary Herron wrote:
> david brochu jr wrote:
> 
>> Hello,
>>  
>> I need to open every file in a directory and search for a string. What
>> module is needed to do this and how would I go about searching each file?

[bash] find /path/to/dir -exec grep -le "searched string" {} \;

Ho, you meant : doing this in Python ?-)


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list