Organizing Python Code

Bill Anderson anderson at boi.hp.com
Thu Oct 12 15:33:56 EDT 2000


Russell Wallace wrote:
> 
> Garth Dighton wrote:
> > This doesn't work when the code is in several directories. I frequently
> > have this problem at work, where the source code for our main product is
> > spread across several hundred files in 50 or so directories (our product is
> > a database server, so the architecture is fairly complicated). You CAN'T
> > just do a grep to find the function definition. (although you can usually
> > grep the include directory to find the declaration, this doesn't always
> > tell you where to look for the definition itself.)
> 
> Should be easy enough to write a little Python script to run grep in
> subdirectories?  This would only need to be done once.


No need. use rgrep ;^)
rgrep is a recursive grep.
(RedHat has it on their cd(s), dunno where else to get it)

rgrep -l "def foo" *

Or you can make a shell macro that combines find, xargs, and grep.


-- 
Bill Anderson (ARC)    Unix/Linux System Administrator
LTDS Team              Thursday, October 12, 2000
Random Quote:
    PARANOID:Paying MORE for Surge-Protectors than Computers



More information about the Python-list mailing list