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; }
In reply to Re: Re: Search & Replace in subdirectory files
by borisz
in thread Search & Replace in subdirectory files
by Rina
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |