in reply to Re: Search & Replace in subdirectory files
in thread Search & Replace in subdirectory files
Not really sure how to make it recurse subdirectories other than adding /* on the end for each level needed:Then we are back at File::Find.
# perl -p -i.bak -e 's/bilbo/frodo/g' */*
#!/usr/bin/perl use File::Find; my @dirs = @ARGV; @ARGV = (); File::Find::find( { wanted => sub { push @ARGV, $File::Find::name if -f } }, @dirs ); $^I = '.bak'; local $_; while ( defined( $_ = <ARGV> ) ) { s/bilbo/frodo/g; print; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Search & Replace in subdirectory files
by bassplayer (Monsignor) on Apr 23, 2004 at 16:05 UTC |