Steve Harper wrote:

> 
> In the end, this is what works:
> 
> perl -pi.bak -e "s/this/that/g" testtextfile.txt
> 
> ...now to find out how to get the backticks working in place of the single
> text file, so I can select an entire hierarchy of text files for
> processing.  :-)  Ah the contortions one goes through to avoid installing
> a decent shell...

Why would you want to use backticks ?  You can do it all in your Perl
script without shelling out.  I would start with using File::Find to
recurse through your tree and find the files you want to process.  Then
just edit each file as you did with the one-liner, but do it inside
your script.  You could then either copy the file to a backup and then
slurp the file, close it and rewrite it (after substituting) or you
could open the file, substitute and write a new file followed by any
renaming of the files you need to get them where you want them.

You could also read in a list of files instead of using File::Find if the
files are already known.

-- 
   ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
  (_/   /  )    // //       DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to