Replacing text for all files in a directory

William Park opengeometry at yahoo.ca
Tue Aug 7 16:27:16 EDT 2001


On Tue, Aug 07, 2001 at 03:20:24PM -0500, Kemp Randy-W18971 wrote:
> Great!  But how can I apply this to all files in a directory, where
> the directory contains 20 files, without listing each file
> individually?

I don't understand what you mean by "without listing each file
individually".  How can you apply the filter to file content without
knowing its filename?

Since you're already running Unix, the easiest solution is to write a
Python script which takes <stdin> and spits out corrected <stdout>.
Then, use shell to call it.  You can, of course, do all these in Python
using 'os' module.

-- 
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
8 CPUs cluster, (Slackware) Linux, Python, LaTeX, Vim, Mutt, Sc.




More information about the Python-list mailing list