stretch has asked for the wisdom of the Perl Monks concerning the following question:

Hail,
I want the following to search thru recursive subdirectories for *.html files.
============== perl -pi.old -e "s|../forum_idx.pl|../cgi-bin/forum_idx.pl|g" *.htm +l ==============

What modifier do I use to search subdirectories?
thanks, Stretch

Replies are listed 'Best First'.
Re: search and replace recursive directories modifier inquiry
by penguinfuz (Pilgrim) on Oct 26, 2002 at 00:01 UTC
    I agree with Enlil, you really should have a look at File::Find, but a quick oneliner (on a Unix/Linux machine) could be:

    find . -name "*.html" | xargs perl -pi -e s/oldstring/newstring/g
Re: search and replace recursive directories modifier inquiry
by Enlil (Parson) on Oct 25, 2002 at 22:27 UTC
    If you are on a unix system you might try a combo of find, xargs and your one liner. I would look into using the File::Find module and writing a slightly longer script instead of a one liner.

    -enlil